Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added twitter card functionality #196

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

blackhat-7
Copy link

I have added the twitter card functionality. So now it extracts namespaces and properties of the twitter cards.
I have also added 3 test cases

This was a needed feature in issue #179

For example the following now works:

>>> extruct.extract('<!doctype html><html><head><meta name="twitter:card" content="summary">')
{'microdata': [], 
'json-ld': [], 
'opengraph': [], 
'microformat': [], 
'rdfa': [],
 'dublincore': [{'namespaces': {}, 'elements': [], 'terms': []}], 
'twittercard': [{'namespace': {'twitter': 'https://dev.twitter.com/cards#'}, 'properties': [('twitter:card', 'summary')]}]}

@blackhat-7 blackhat-7 changed the title Twittercard Added twitter card functionality May 13, 2022
@stephentgrammer
Copy link

Would love to see this get in the next version tag! @blackhat-7, you might want to update the REAME to mention twitter card usage.

Copy link
Member

@lopuhin lopuhin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR @blackhat-7 , still reading a code, left one comment below.

from extruct.twittercard import TwitterCardExtractor
from tests import get_testdata, jsonize_dict

class TestTwittercard(unittest.TestCase):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants