Comments (5)
Hi, I'd like to work on this issue, can you assign it to me ?
Hi @ragnerok contributions are very welcome, I don't think anyone is working on this.
One way to solve this issue while keeping it backward compatible is to add a flag with_og_array that returns an og_array if it is true.
Sounds good to me š
from extruct.
Same problem in my case. Open Graph with uniform
avoids the possibility of extracting multiple images. Only last image is returned. Example:
import pprint
import extruct
pp = pprint.PrettyPrinter(indent=2)
html = """<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="https://www.w3.org/1999/xhtml" xmlns:og="https://ogp.me/ns#" xmlns:fb="https://www.facebook.com/2008/fbml">
<head>
<title>Himanshu's Open Graph Protocol</title>
<meta http-equiv="Content-Type" content="text/html;charset=WINDOWS-1252" />
<meta http-equiv="Content-Language" content="en-us" />
<link rel="stylesheet" type="text/css" href="event-education.css" />
<meta name="verify-v1" content="so4y/3aLT7/7bUUB9f6iVXN0tv8upRwaccek7JKB1gs=" >
<meta property="og:title" content="Himanshu's Open Graph Protocol"/>
<meta property="og:type" content="article"/>
<meta property="og:url" content="https://www.eventeducation.com/test.php"/>
<meta property="og:image" content="https://www.eventeducation.com/images/1.jpg"/>
<meta property="og:image:width" content="400" />
<meta property="og:image" content="https://www.eventeducation.com/images/2.jpg"/>
<meta property="og:image:width" content="500" />
<meta property="fb:admins" content="himanshu160"/>
<meta property="og:site_name" content="Event Education"/>
<meta property="og:description" content="Event Education provides free courses on event planning and management to event professionals worldwide."/>
</head>
<body>
</body>
</html>"""
pp.pprint(extruct.extract(html, uniform=True)['opengraph'])
result:
[ { '@context': {'og': 'http://ogp.me/ns#'},
'@type': 'article',
'og:description': 'Event Education provides free courses on event planning '
'and management to event professionals worldwide.',
'og:image': 'https://www.eventeducation.com/images/2.jpg',
'og:image:width': '500',
'og:site_name': 'Event Education',
'og:title': "Himanshu's Open Graph Protocol",
'og:url': 'https://www.eventeducation.com/test.php'}]
from extruct.
If backward compatibility is to be kept, Iām not sure what the best approach would be.
from extruct.
Hi, I'd like to work on this issue, can you assign it to me ?
One way to solve this issue while keeping it backward compatible is to add a flag with_og_array that returns an og_array if it is true.
from extruct.
Hey @lopuhin, I've added the changes that I think will fix the issue. Could you look into it and let me know if I need to change something else ? I'll add the test cases in some time.
from extruct.
Related Issues (20)
- rdflib 6.0.0 does not always return bytes, breaking extruct.rdfa.RDFaExtractor HOT 3
- Adding twitter tags HOT 5
- Extruct - 0.13.0 is not compatible with the latest rdflib HOT 5
- Installation error: "rdflib-jsonld setup command: use_2to3 is invalid" HOT 1
- ValueError: Unicode strings with encoding declaration are not supported. Please use bytes input or XML fragments without declaration. HOT 6
- ModuleNotFoundError: No module named 'rdflib_jsonld.serializer HOT 9
- Example from the README does not work any more
- Extruct not matching up with Schema.org structured data testing tool (Incorrect image Urls) HOT 3
- Some websites put meta tags outside the head. HOT 2
- Very slow extraction for specific string HOT 5
- LD+JSON outside HTML element HOT 1
- error extracting json-ld for validated json
- [suggestion] adding type hints? HOT 7
- Should not Depends on python3 (<< 3.7) HOT 6
- lxml.etree.ParserError: Document is empty HOT 5
- " in application/ld+json gives exception
- Consider switching from lxml's clean_html for enhanced security (and possibly performance) HOT 7
- Selectolax benchmarks
- Unable to get meta tag value from inside body
- SyntaxWarning invalid escape sequence '\s'
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
š Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ššš
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ā¤ļø Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from extruct.