{"id":13937073,"url":"https://github.com/erikriver/opengraph","last_synced_at":"2025-07-19T22:33:54.207Z","repository":{"id":45272102,"uuid":"1910030","full_name":"erikriver/opengraph","owner":"erikriver","description":"A python module to parse the Open Graph Protocol","archived":false,"fork":false,"pushed_at":"2021-12-26T03:18:57.000Z","size":15,"stargazers_count":228,"open_issues_count":23,"forks_count":82,"subscribers_count":15,"default_branch":"master","last_synced_at":"2024-11-11T11:12:01.309Z","etag":null,"topics":["ogp","python"],"latest_commit_sha":null,"homepage":"http://ogp.me/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/erikriver.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2011-06-17T08:11:10.000Z","updated_at":"2024-10-24T05:17:56.000Z","dependencies_parsed_at":"2022-09-14T07:22:06.232Z","dependency_job_id":null,"html_url":"https://github.com/erikriver/opengraph","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erikriver%2Fopengraph","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erikriver%2Fopengraph/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erikriver%2Fopengraph/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erikriver%2Fopengraph/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/erikriver","download_url":"https://codeload.github.com/erikriver/opengraph/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226693903,"owners_count":17667757,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ogp","python"],"created_at":"2024-08-07T23:03:15.256Z","updated_at":"2024-11-27T05:30:50.016Z","avatar_url":"https://github.com/erikriver.png","language":"Python","readme":"OpenGraph is a module of python for parsing the Open Graph Protocol, you can read more about the specification at http://ogp.me/\n\nInstallation\n=============\n\n.. code-block:: console\n\n   $ pip install opengraph\n\nFeatures\n=============\n\n* Use it as a python dict\n* Input and parsing from a specific url\n* Input and parsung from html previous extracted\n* HTML output\n* JSON output\n\nUsage\n==============\n\n**From an URL**\n\n.. code-block:: pycon\n\n   \u003e\u003e\u003e import opengraph\n   \u003e\u003e\u003e video = opengraph.OpenGraph(url=\"http://www.youtube.com/watch?v=q3ixBmDzylQ\")\n   \u003e\u003e\u003e video.is_valid()\n   True\n   \u003e\u003e\u003e for x,y in video.items():\n   ...     print \"%-15s =\u003e %s\" % (x, y)\n   ...\n   site_name       =\u003e YouTube\n   description     =\u003e Eric Clapton and Paul McCartney perform George Harrison's \"While My Guitar Gently Weeps\" at the...\n   title           =\u003e While My Guitar Gently Weeps\n   url             =\u003e http://www.youtube.com/watch?v=q3ixBmDzylQ\n   image           =\u003e http://i2.ytimg.com/vi/q3ixBmDzylQ/default.jpg\n   video:type      =\u003e application/x-shockwave-flash\n   video:height    =\u003e 224\n   video           =\u003e http://www.youtube.com/v/q3ixBmDzylQ?version=3\u0026autohide=1\n   video:width     =\u003e 398\n   type            =\u003e video\n\n**From HTML**\n\n.. code-block:: pycon\n\n   \u003e\u003e\u003e HTML = \"\"\"\n   ... \u003chtml xmlns:og=\"http://ogp.me/ns#\"\u003e\n   ... \u003chead\u003e\n   ... \u003ctitle\u003eThe Rock (1996)\u003c/title\u003e\n   ... \u003cmeta property=\"og:title\" content=\"The Rock\" /\u003e\n   ... \u003cmeta property=\"og:type\" content=\"movie\" /\u003e\n   ... \u003cmeta property=\"og:url\" content=\"http://www.imdb.com/title/tt0117500/\" /\u003e\n   ... \u003cmeta property=\"og:image\" content=\"http://ia.media-imdb.com/images/rock.jpg\" /\u003e\n   ... \u003c/head\u003e\n   ... \u003c/html\u003e\n   ... \"\"\"\n   \u003e\u003e\u003e movie = opengraph.OpenGraph() # or you can instantiate as follows: opengraph.OpenGraph(html=HTML)\n   \u003e\u003e\u003e movie.parser(HTML)\n   \u003e\u003e\u003e video.is_valid()\n   True\n\n**Generate JSON or HTML**\n\n.. code-block:: pycon\n\n   \u003e\u003e\u003e ogp = opengraph.OpenGraph(\"http://ogp.me/\")\n   \u003e\u003e\u003e print ogp.to_json()\n   {\"image:type\": \"image/png\", \"title\": \"Open Graph protocol\", \"url\": \"http://ogp.me/\", \"image\": \"http://ogp.me/logo.png\", \"scrape\": false, \"_url\": \"http://ogp.me/\", \"image:height\": \"300\", \"type\": \"website\", \"image:width\": \"300\", \"description\": \"The Open Graph protocol enables any web page to become a rich object in a social graph.\"}\n   \u003e\u003e\u003e print ogp.to_html()\n\n   \u003cmeta property=\"og:image:type\" content=\"image/png\" /\u003e\n   \u003cmeta property=\"og:title\" content=\"Open Graph protocol\" /\u003e\n   \u003cmeta property=\"og:url\" content=\"http://ogp.me/\" /\u003e\n   \u003cmeta property=\"og:image\" content=\"http://ogp.me/logo.png\" /\u003e\n   \u003cmeta property=\"og:scrape\" content=\"False\" /\u003e\n   \u003cmeta property=\"og:_url\" content=\"http://ogp.me/\" /\u003e\n   \u003cmeta property=\"og:image:height\" content=\"300\" /\u003e\n   \u003cmeta property=\"og:type\" content=\"website\" /\u003e\n   \u003cmeta property=\"og:image:width\" content=\"300\" /\u003e\n   \u003cmeta property=\"og:description\" content=\"The Open Graph protocol enables any web page to become a rich object in a social graph.\" /\u003e\n","funding_links":[],"categories":["资源列表","Web Content Extracting","Python"],"sub_categories":["网页内容提取"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ferikriver%2Fopengraph","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ferikriver%2Fopengraph","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ferikriver%2Fopengraph/lists"}