📚 Golang package for getting oEmbed data from URL
Find a file
2019-05-27 14:52:44 +05:00
assets 🍱 Added actual providers.json asset 2019-05-23 19:51:26 +05:00
.gitlab-ci.yml 💚 Removed linters checking 2019-05-27 14:46:25 +05:00
a_oembed-packr.go ♻️ Refactored source code, packed providers.json 2019-05-24 14:29:36 +05:00
errors.go ♻️ Refactored source code, packed providers.json 2019-05-24 14:29:36 +05:00
fetch_embed.go ♻️ Refactored source code, packed providers.json 2019-05-24 14:29:36 +05:00
fetch_embed_test.go 🚨 Removed linter warnings 2019-05-27 14:43:53 +05:00
find_provider.go ♻️ Refactored source code, packed providers.json 2019-05-24 14:29:36 +05:00
find_provider_test.go ♻️ Refactored source code, packed providers.json 2019-05-24 14:29:36 +05:00
go.mod 📦 Updated go-module 2019-05-24 15:18:38 +05:00
go.sum 📦 Updated go-module 2019-05-24 15:18:38 +05:00
is_valid_url.go 🚧 Created worked version of the package 2019-05-23 19:52:58 +05:00
is_valid_url_test.go 🚧 Created worked version of the package 2019-05-23 19:52:58 +05:00
LICENSE.md 🎉 Initial commit 2019-05-23 19:50:08 +05:00
Makefile 🔧 Added Makefile 2019-05-24 14:29:54 +05:00
oembed.go 🚨 Removed linter warnings 2019-05-27 14:43:53 +05:00
oembed_test.go 🚧 Created worked version of the package 2019-05-23 19:52:58 +05:00
patrons.go 👥 Added patrons list in log 2019-05-27 14:40:58 +05:00
README.md 📝 Fixed README.md 2019-05-24 15:16:46 +05:00
SUPPORT.md 👥 Added patrons list 2019-05-23 19:50:50 +05:00
sync.go ♻️ Refactored source code, packed providers.json 2019-05-24 14:29:36 +05:00
sync_test.go ♻️ Refactored source code, packed providers.json 2019-05-24 14:29:36 +05:00
types.go 🚨 Removed linter warnings 2019-05-27 14:43:53 +05:00
types_ffjson.go ♻️ Refactored source code, packed providers.json 2019-05-24 14:29:36 +05:00

oEmbed

oEmbed is a format for allowing an embedded representation of a URL on third party sites. The simple API allows a website to display embedded content (such as photos or videos) when a user posts a link to that resource, without having to parse the resource directly.

Start using oEmbed

Download and install it:
$ go get -u gitlab.com/toby3d/oembed

Import it in your code:
import "gitlab.com/toby3d/oembed"

Example

package main

import "gitlab.com/toby3d/oembed"

var targetUrl = "https://www.youtube.com/watch?v=8jPQjjsBbIc"

func main() {
  // optional: checks what url has YouTube provider
  if !oembed.HasProvider(targetUrl) {
    return
  }

  // extract oEmbed object of source url
  data, err := oembed.Extract(targetUrl)
  if err != nil {
    // provider not found / source not found / bad response...
    panic(err)
  }

  // use data as you want
}