{"id":13747684,"url":"https://github.com/ruby-oembed/ruby-oembed","last_synced_at":"2025-05-09T09:30:51.435Z","repository":{"id":397513,"uuid":"15620","full_name":"ruby-oembed/ruby-oembed","owner":"ruby-oembed","description":"oEmbed for Ruby","archived":false,"fork":false,"pushed_at":"2024-02-25T23:27:46.000Z","size":16582,"stargazers_count":336,"open_issues_count":15,"forks_count":70,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-04-26T03:22:26.123Z","etag":null,"topics":["oembed","ruby","rubygem"],"latest_commit_sha":null,"homepage":"http://oembed.com/","language":"Ruby","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/ruby-oembed.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.rdoc","contributing":null,"funding":null,"license":"LICENSE","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":"2008-05-09T13:50:39.000Z","updated_at":"2024-06-18T13:39:26.936Z","dependencies_parsed_at":"2024-01-13T03:01:35.013Z","dependency_job_id":"11a4d70f-db8c-4084-9444-97877c704509","html_url":"https://github.com/ruby-oembed/ruby-oembed","commit_stats":{"total_commits":399,"total_committers":42,"mean_commits":9.5,"dds":0.7669172932330828,"last_synced_commit":"5b97e07df1ad98d67d3ed492dd3d81bdf246020a"},"previous_names":[],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruby-oembed%2Fruby-oembed","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruby-oembed%2Fruby-oembed/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruby-oembed%2Fruby-oembed/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruby-oembed%2Fruby-oembed/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ruby-oembed","download_url":"https://codeload.github.com/ruby-oembed/ruby-oembed/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224616556,"owners_count":17341151,"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":["oembed","ruby","rubygem"],"created_at":"2024-08-03T06:01:37.774Z","updated_at":"2025-05-09T09:30:51.423Z","avatar_url":"https://github.com/ruby-oembed.png","language":"Ruby","funding_links":[],"categories":["Ruby"],"sub_categories":[],"readme":"# ruby-oembed\n\n[![Gem](https://img.shields.io/gem/v/ruby-oembed.svg)](https://rubygems.org/gems/ruby-oembed)\n[![Test Coverage](https://github.com/ruby-oembed/ruby-oembed/actions/workflows/ruby.yml/badge.svg)](https://github.com/ruby-oembed/ruby-oembed/actions/workflows/ruby.yml)\n[![Code Climate](https://img.shields.io/codeclimate/maintainability/ruby-oembed/ruby-oembed.svg)](https://codeclimate.com/github/ruby-oembed/ruby-oembed)\n[![Coveralls](https://coveralls.io/repos/github/ruby-oembed/ruby-oembed/badge.svg?branch=coveralls)](https://coveralls.io/github/ruby-oembed/ruby-oembed?branch=coveralls)\n![Maintenance](https://img.shields.io/maintenance/yes/2025.svg)\n\n\nAn oEmbed consumer library written in Ruby, letting you easily get embeddable HTML representations of supported web pages, based on their URLs. See [oembed.com](http://oembed.com) for more about the protocol.\n\n# Installation\n\n  gem install ruby-oembed\n\n# Get Started\n\n## Built-in Providers\n\nThe easiest way to use this library is to make use of the built-in providers.\n\n```ruby\nOEmbed::Providers.register_all\nresource = OEmbed::Providers.get('http://www.youtube.com/watch?v=2BYXBC8WQ5k')\nresource.video? #=\u003e true\nresource.thumbnail_url #=\u003e \"http://i3.ytimg.com/vi/2BYXBC8WQ5k/hqdefault.jpg\"\nresource.html #=\u003e \u003c\u003c-HTML\n  \u003cobject width=\"425\" height=\"344\"\u003e\n    \u003cparam name=\"movie\" value=\"http://www.youtube.com/v/2BYXBC8WQ5k?fs=1\"\u003e\u003c/param\u003e\n    \u003cparam name=\"allowFullScreen\" value=\"true\"\u003e\u003c/param\u003e\n    \u003cparam name=\"allowscriptaccess\" value=\"always\"\u003e\u003c/param\u003e\n    \u003cembed src=\"http://www.youtube.com/v/2BYXBC8WQ5k?fs=1\" type=\"application/x-shockwave-flash\" width=\"425\" height=\"344\" allowscriptaccess=\"always\" allowfullscreen=\"true\"\u003e\u003c/embed\u003e\n  \u003c/object\u003e\nHTML\n```\n\n### Providers requiring an access token\n\nSome built-in providers require authorization in order to work. These providers won't be registered unless an access token is provided. You can either pass access tokens to the `register_app` method.\n\n```ruby\nOEmbed::Providers.register_all(access_tokens: { facebook: @my_facebook_token })\n```\n\nOr you can provide access tokens via environment variable\n```ruby\nENV['OEMBED_FACEBOOK_TOKEN'] #=\u003e 'my-access-token'\nOEmbed::Providers.register_all\n```\n\n#### Currently supported access tokens\n\n| access_token | environment variable    | Associated Providers |\n|--------------|-------------------------|----------------------|\n| `:facebook`  | `OEMBED_FACEBOOK_TOKEN` | `FacebookPost`, `FacebookVideo`, `Instagram` |\n\n## Custom Providers\n\nIf you'd like to use a provider that isn't included in the library, it's easy to create one. Just provide the oEmbed API endpoint and URL scheme(s).\n\n```ruby\nmy_provider = OEmbed::Provider.new(\"http://my.cool-service.com/api/oembed_endpoint.{format}\")\nmy_provider \u003c\u003c \"http://*.cool-service.com/image/*\"\nmy_provider \u003c\u003c \"http://*.cool-service.com/video/*\"\n```\n\nYou can then use your new custom provider *or* you can register it along with the rest of the built-in providers.\n\n```ruby\nresource = my_provider.get(\"http://a.cool-service.com/video/1\") #=\u003e OEmbed::Response\nresource.provider.name #=\u003e \"My Cool Service\"\n\nOEmbed::Providers.register(my_provider)\nresource = OEmbed::Providers.get(\"http://a.cool-service.com/video/2\") #=\u003e OEmbed::Response\n```\n\n## Fallback Providers\n\nLast but not least, ruby-oembed supports [Noembed](https://noembed.com/), [Embedly](http://embed.ly), provider discovery. The first two are provider aggregators. Each supports a wide array of websites ranging from [Amazon.com](http://www.amazon.com) to [xkcd](http://www.xkcd.com). The later is part of the oEmbed specification that allows websites to advertise support for the oEmbed protocol.\n\n```ruby\nOEmbed::Providers.register_fallback(\n  OEmbed::ProviderDiscovery,\n  OEmbed::Providers::Noembed\n)\nOEmbed::Providers.get('https://www.xkcd.com/802/') #=\u003e OEmbed::Response\n```\n\n## Formatters\n\nThis library works wonderfully on its own, but can get a speed boost by using 3rd party libraries to parse oEmbed data. To use a 3rd party Formatter, just be sure to require the library _before_ ruby-oembed (or include them in your Gemfile before ruby-oembed).\n\n```ruby\nrequire 'json'\nrequire 'xmlsimple'\nrequire 'oembed'\n\nOEmbed::Formatter::JSON.backend #=\u003e OEmbed::Formatter::JSON::Backends::JSONGem\nOEmbed::Formatter::XML.backend  #=\u003e OEmbed::Formatter::XML::Backends::XmlSimple\n```\n\nThe following, optional, backends are currently supported:\n* The [JSON implementation for Ruby](http://flori.github.com/json/)\n* Rails' ActiveSupport::JSON (confirmed to work with Rails 3.0.x and should work with Rails 2.0+)\n* [XmlSimple](http://xml-simple.rubyforge.org/)\n\n# Lend a Hand\n\nCode for the ruby-oembed library is [hosted on GitHub](https://github.com/ruby-oembed/ruby-oembed).\n\n```bash\n# Get the code.\ngit clone git://github.com/ruby-oembed/ruby-oembed.git\ncd ruby-oembed\n# Install all development-related gems.\ngem install bundler\nbundle install\n# Run the tests.\nbundle exec rake\n# or run the test continually\nbundle exec guard\n```\n\nIf you encounter any bug, feel free to [create an Issue](https://github.com/ruby-oembed/ruby-oembed/issues).\n\nWe gladly accept pull requests! Just [fork](http://help.github.com/forking/) the library and commit your changes along with relevant tests. Once you're happy with the changes, [send a pull request](http://help.github.com/pull-requests/).\n\nWe do our best to [keep our tests green](https://github.com/ruby-oembed/ruby-oembed/actions/workflows/ruby.yml)\n\n# Contributors\n\nThanks to [all who have made contributions](https://github.com/ruby-oembed/ruby-oembed/contributors) to this gem, both large and small.\n\n# License\n\nThis code is free to use under the terms of the MIT license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fruby-oembed%2Fruby-oembed","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fruby-oembed%2Fruby-oembed","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fruby-oembed%2Fruby-oembed/lists"}