gogo-langgolanggolang-librarygolang-modulegolang-packagego-librarygo-modulesgo-packagego-packagesoembed
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.
|
4 years ago | |
---|---|---|
assets | 4 years ago | |
.gitlab-ci.yml | 4 years ago | |
LICENSE.md | 4 years ago | |
Makefile | 4 years ago | |
README.md | 4 years ago | |
SUPPORT.md | 4 years ago | |
a_oembed-packr.go | 4 years ago | |
errors.go | 4 years ago | |
fetch_embed.go | 4 years ago | |
fetch_embed_test.go | 4 years ago | |
find_provider.go | 4 years ago | |
find_provider_test.go | 4 years ago | |
go.mod | 4 years ago | |
go.sum | 4 years ago | |
is_valid_url.go | 4 years ago | |
is_valid_url_test.go | 4 years ago | |
oembed.go | 4 years ago | |
oembed_test.go | 4 years ago | |
patrons.go | 4 years ago | |
sync.go | 4 years ago | |
sync_test.go | 4 years ago | |
types.go | 4 years ago | |
types_ffjson.go | 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
}