{"id":18000150,"url":"https://github.com/goofansu/ogp","last_synced_at":"2025-05-09T03:39:52.068Z","repository":{"id":50792396,"uuid":"371664268","full_name":"goofansu/ogp","owner":"goofansu","description":"The Open Graph protocol library in Elixir","archived":false,"fork":false,"pushed_at":"2024-09-01T14:00:02.000Z","size":62,"stargazers_count":25,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-03T00:42:52.419Z","etag":null,"topics":["elixir","metatags","opengraph","social"],"latest_commit_sha":null,"homepage":"https://hex.pm/packages/ogp","language":"Elixir","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/goofansu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-05-28T10:27:57.000Z","updated_at":"2025-03-13T01:17:08.000Z","dependencies_parsed_at":"2024-10-29T23:30:04.734Z","dependency_job_id":null,"html_url":"https://github.com/goofansu/ogp","commit_stats":{"total_commits":41,"total_committers":2,"mean_commits":20.5,"dds":0.04878048780487809,"last_synced_commit":"154ae95f33e401c9c9127873b39d2ed8a2e85289"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goofansu%2Fogp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goofansu%2Fogp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goofansu%2Fogp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goofansu%2Fogp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/goofansu","download_url":"https://codeload.github.com/goofansu/ogp/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253186687,"owners_count":21868064,"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":["elixir","metatags","opengraph","social"],"created_at":"2024-10-29T23:09:53.315Z","updated_at":"2025-05-09T03:39:52.052Z","avatar_url":"https://github.com/goofansu.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ogp\n\nThe [Open Graph protocol](https://ogp.me/) library in Elixir.\n\n[![CI](https://github.com/goofansu/ogp/actions/workflows/ci.yml/badge.svg)](https://github.com/goofansu/ogp/actions/workflows/ci.yml)\n[![Coverage Status](https://coveralls.io/repos/github/goofansu/ogp/badge.svg?branch=main)](https://coveralls.io/github/goofansu/ogp?branch=main)\n[![Version](https://img.shields.io/hexpm/v/ogp.svg)](https://hex.pm/packages/ogp)\n\n## Installation\n\n```elixir\ndef deps do\n  [\n    {:ogp, \"~\u003e 1.1.0\"}\n  ]\nend\n```\n\n## Usage\n\nIt is recommended to run [ogp.livemd](https://github.com/goofansu/ogp/blob/main/ogp.livemd) in [Livebook](https://github.com/elixir-nx/livebook) for more details.\n\n### Parse HTML\n\n```elixir\niex\u003e html = \"\"\"\n\u003cmeta property=\"og:title\" content=\"The Rock\" /\u003e\n\u003cmeta property=\"og:type\" content=\"video.movie\" /\u003e\n\u003cmeta property=\"og:url\" content=\"https://www.imdb.com/title/tt0117500/\" /\u003e\n\u003cmeta property=\"og:image\" content=\"https://ia.media-imdb.com/images/rock.jpg\" /\u003e\n\u003cmeta property=\"og:image\" content=\"https://ia.media-imdb.com/images/rock2.jpg\" /\u003e\n\u003cmeta property=\"og:audio\" content=\"https://example.com/bond/theme.mp3\" /\u003e\n\u003cmeta property=\"og:description\"\n  content=\"Sean Connery found fame and fortune as the\n           suave, sophisticated British agent, James Bond.\" /\u003e\n\u003cmeta property=\"og:determiner\" content=\"the\" /\u003e\n\u003cmeta property=\"og:locale\" content=\"en_GB\" /\u003e\n\u003cmeta property=\"og:locale:alternate\" content=\"fr_FR\" /\u003e\n\u003cmeta property=\"og:site_name\" content=\"IMDb\" /\u003e\n\u003cmeta property=\"og:video\" content=\"https://example.com/bond/trailer.swf\" /\u003e\n\"\"\"\niex\u003e OpenGraph.parse(html)\n%OpenGraph{\n  audio: \"https://example.com/bond/theme.mp3\",\n  description: \"Sean Connery found fame and fortune as the\\n           suave, sophisticated British agent, James Bond.\",\n  determiner: \"the\",\n  image: \"https://ia.media-imdb.com/images/rock.jpg\",\n  locale: \"en_GB\",\n  site_name: \"IMDb\",\n  title: \"The Rock\",\n  type: \"video.movie\",\n  url: \"https://www.imdb.com/title/tt0117500/\",\n  video: \"https://example.com/bond/trailer.swf\"\n}\n```\n\n### Fetch URL\n\n```elixir\niex\u003e OpenGraph.fetch!(\"https://github.com\")\n%OpenGraph{\n  audio: nil,\n  description: \"GitHub is where over 65 million developers shape the future of software, together. Contribute to the open source community, manage your Git repositories, review code like a pro, track bugs and feat...\",\n  determiner: nil,\n  image: \"https://github.githubassets.com/images/modules/site/social-cards/github-social.png\",\n  locale: nil,\n  site_name: \"GitHub\",\n  title: \"GitHub: Where the world builds software\",\n  type: \"object\",\n  url: \"https://github.com/\",\n  video: nil\n}\n```\n\nRedirects are followed automatically by default.\n\n```elixir\niex\u003e OpenGraph.fetch!(\"https://producthunt.com\")\n\n[debug] redirecting to https://www.producthunt.com/\n%OpenGraph{\n  title: \" Product Hunt – The best new products in tech. \",\n  type: \"article\",\n  image: \"https://ph-static.imgix.net/ph-logo-1.png\",\n  url: \"https://www.producthunt.com/\",\n  audio: nil,\n  description: \"Product Hunt is a curation of the best new products, every day. Discover the latest mobile apps, websites, and technology products that everyone's talking about.\",\n  determiner: nil,\n  locale: \"en_US\",\n  site_name: \"Product Hunt\",\n  video: nil\n}\n```\n\nYou can control redirects by configuring `req_options`.\n\n- Disable redirects:\n\n```elixir\nconfig :ogp,\n  req_options: [\n    redirect: false\n  ]\n```\n\n- Set a different `max_redirects` (default is `10`):\n\n```elixir\nconfig :ogp,\n  req_options: [\n    max_redirects: 3\n  ]\n```\n\nSee https://hexdocs.pm/req/Req.html#new/1-options for the full `req` options.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoofansu%2Fogp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgoofansu%2Fogp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoofansu%2Fogp/lists"}