modulepackage
0.0.0-20150403100640-d2ea73d958a0
Repository: https://github.com/hapara/opengraph.git
Documentation: pkg.go.dev
# README
opengraph
opengraph is a Go library for extracting Open Graph metadata from html documents.
Documentation: http://godoc.org/github.com/rojters/opengraph
Open Graph protocol: http://ogp.me/
Build Status:
Usage
import "github.com/rojters/opengraph"
To extract Open Graph metadata from a movie on IMDb:
res, _ := http.Get("http://www.imdb.com/title/tt0118715/")
og, _ := opengraph.Extract(res.Body)
for _, md := range og {
fmt.Printf("%s = %s\n", md.Property, md.Content)
}
Which will output:
url = http://www.imdb.com/title/tt0118715/
type = video.movie
title = The Big Lebowski (1998)
site_name = IMDb
description = Directed by Joel Coen, Ethan Coen. With Jeff Bridges ...
...
License
MIT
# Functions
Extract extracts Open Graph metadata from a html document.
# Variables
By default Extract will only return metadata in the Open Graph namespace.