📚 Golang package for getting oEmbed data from URL
You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
Maxim Lebedev 42da6d95f8
🔀 Merge branch 'develop'
4 years ago
assets 🍱 Added actual providers.json asset 4 years ago
.gitlab-ci.yml 💚 Removed linters checking 4 years ago
LICENSE.md 🎉 Initial commit 4 years ago
Makefile 🔧 Added Makefile 4 years ago
README.md 📝 Fixed README.md 4 years ago
SUPPORT.md 👥 Added patrons list 4 years ago
a_oembed-packr.go ♻️ Refactored source code, packed providers.json 4 years ago
errors.go ♻️ Refactored source code, packed providers.json 4 years ago
fetch_embed.go ♻️ Refactored source code, packed providers.json 4 years ago
fetch_embed_test.go 🚨 Removed linter warnings 4 years ago
find_provider.go ♻️ Refactored source code, packed providers.json 4 years ago
find_provider_test.go ♻️ Refactored source code, packed providers.json 4 years ago
go.mod 📦 Updated go-module 4 years ago
go.sum 📦 Updated go-module 4 years ago
is_valid_url.go 🚧 Created worked version of the package 4 years ago
is_valid_url_test.go 🚧 Created worked version of the package 4 years ago
oembed.go 🚨 Removed linter warnings 4 years ago
oembed_test.go 🚧 Created worked version of the package 4 years ago
patrons.go 👥 Added patrons list in log 4 years ago
sync.go ♻️ Refactored source code, packed providers.json 4 years ago
sync_test.go ♻️ Refactored source code, packed providers.json 4 years ago
types.go 🚨 Removed linter warnings 4 years ago
types_ffjson.go ♻️ Refactored source code, packed providers.json 4 years ago

README.md

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
}