Skip to content

roperzh/gopengraph

Repository files navigation

Gopengraph CI Status

GopenGraph is a very simple Go library for parsing Open Graph protocol and Metadata information from web sites.

Installation

$ go get github.com/roperzh/gopengraph

Usage

import (
  "fmt"

  "github.com/PuerkitoBio/goquery"
  "github.com/roperzh/gopengraph"
)

// Directly from an URL
pageFromUrl := gopengraph.NewFromUrl("https://github.com/")

fmt.Printf("Title: %s, Description: %s", pageFromUrl.Title, pageFromUrl.Description)
// => Title: Build software better, together, Description: GitHub is ..

// From a *goquery.Document
doc, err := goquery.NewDocument(url)
pageFromDocument := gopengraph.New(doc)

fmt.Printf("og:site_name: %s, og:url: %s", pageFromDocument.OgAttrs["og:site_name"], pageFromDocument.OgAttrs["og:url"])
// => og:site_name: GitHub, og:url: https://github.com

Contributing

1- Fork it

2- Create your feature branch (git checkout -b my-new-feature)

3- Commit your changes (git commit -am 'Add some feature')

4- Push to the branch (git push origin my-new-feature)

5- Create new Pull Request

License

MIT License

About

Go library for parsing Open Graph protocol and Metadata information from web sites.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages