Skip to main content

Opengrapher

utility for parsing the Open Graph tags from url

(read more about the specification at http://ogp.me/)

Installation

   $ pip install opengrapher

Usage

   >>> import opengrapher
   >>> opengrapher.parse('https://www.imdb.com/title/tt0110912')
   {
      "url": "https://www.imdb.com/title/tt0110912",
      "title": "Pulp Fiction (1994) - IMDb",
      "type": "video.movie",
      "image": "https://m.media-amazon.com/images/M/MV5BNGNhMDIzZTUtNTBlZi00MTRlLWFjM2ItYzViMjE3YzI5MjljXkEyXkFqcGdeQXVyNzkwMjQ5NzM@._V1_UY1200_CR97,0,630,1200_AL_.jpg",
      "description": """
         Directed by Quentin Tarantino.  With John Travolta, Uma Thurman, 
         Samuel L. Jackson, Bruce Willis. The lives of two mob hitmen, 
         a boxer, a gangster and his wife, and a pair of diner bandits 
         intertwine in four tales of violence and redemption.
      """,
   }

List of parsing tags is stored in PARSE_TAGS constant

   >>> from opengrapher import PARSE_TAGS
   >>> PARSE_TAGS
   ["url", "title", "type", "image", "description"]

You can pass a specific list of tags to parse function if you want:

   >>> import opengrapher
   >>> custom_tags = ['url', 'title']
   >>> opengrapher.parse('https://www.imdb.com/title/tt0110912', parse_tags=custom_tags)
   {
      "url": "https://www.imdb.com/title/tt0110912",
      "title": "Pulp Fiction (1994) - IMDb",
   }

Note that all tags will be transformed to "og:{tag}" format, as it stated in opengraph notation

Release files for opengrapher 0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for opengrapher 0.4
File Size Uploaded
opengrapher-0.4.tar.gz 2.7 kB Details

Release files / opengrapher-0.4.tar.gz

Download URL opengrapher-0.4.tar.gz
Size 2.7 kB
Tags Source
SHA-256 checksum
How to use checksums
eff2cde1188f41b9f57ea610f960c7c40501906114e940d72b0c8938947227a2
BLAKE2b-256 checksum
How to use checksums
c6ceb2e05c727a98bc38c7d5bd423724f3f6dd11212a2518b78be0a8302b7eed
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.6.4

Release history Release notifications | RSS feed

This release

0.4 This release

1 release file

0.3

1 release file

0.2.2

2 release files

0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page