Extract Meta Tags in structured way - #28
Merged
Merged
Conversation
There is a lot of meta data that poeple put in meta tags. Espcially
when you realize that Open Graph, and Twitter Cards are very popular.
Therefore I suggest that should be a way to extract the tags from
an article.
Here is an example:
```sh
import newspaper
article = newspaper.build_article('http://www.buzzfeed.com/tabirakhter/epic-literary-love-tattoos')
article.download()
article.parse()
print pprint.pformat(dict(article.meta_data))
{'article': {'publisher': 'https://www.facebook.com/BuzzFeed',
'section': 'DIY',
'tag': 'Tattoos'},
'og': {'description': 'All is fair in love and ink.',
'image': {'height': 625,
'url': 'http://s3-ak.buzzfeed.com/static/2014-01/enhanced/webdr06/22/16/enhanced-buzz-8304-1390426280-19.jpg',
'width': 625},
'site_name': 'BuzzFeed',
'title': '23 Epic Literary Love Tattoos',
'type': 'article',
'url': 'http://www.buzzfeed.com/tabirakhter/epic-literary-love-tattoos'},
'twitter': {'app': {'id': {'googleplay': 'com.buzzfeed.android',
'ipad': 'id352969997',
'iphone': 'id352969997'},
'url': {'googleplay': 'http://www.buzzfeed.com/tabirakhter/epic-literary-love-tattoos'}},
'card': 'summary_large_image',
'creator': '@tabooradley',
'description': 'All is fair in love and ink.',
'image': 'http://s3-ak.buzzfeed.com/static/2014-01/campaign_images/webdr06/26/14/23-epic-literary-love-tattoos-1-1410-1390763440-3_big.jpg',
'site': '@buzzfeed',
'title': '23 Epic Literary Love Tattoos',
'url': 'http://www.buzzfeed.com/tabirakhter/epic-literary-love-tattoos'}}
```
Owner
|
This is very cool, thanks! This will most likely be merged by tonight after I look it over. |
codelucas
added a commit
that referenced
this pull request
Jan 27, 2014
Extract Meta Tags in structured way
Owner
|
This will be in the 0.0.7 release + the documentation. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
There is a lot of meta data that poeple put in meta tags. Espcially
when you realize that Open Graph, and Twitter Cards are very popular.
Therefore I suggest that should be a way to extract the tags from
an article.
Here is an example: