Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( BadStatusCodeErr = errors.New("Bad status code") UnsupportedPageErr = errors.New("Unsupported page") )
Functions ¶
func Fetch ¶
func Fetch(rawurl string, i interface{}, opts ...ParserOpts) error
Fetch the content from the URL and parse OGP information.
Types ¶
type Image ¶
type Image struct { URL string `googp:"og:image,og:image:url" json:"url,omitempty"` SecureURL string `googp:"og:image:secure_url" json:"secure_url,omitempty"` Type string `googp:"og:image:type" json:"type,omitempty"` Width int `googp:"og:image:width" json:"width,omitempty"` Height int `googp:"og:image:height" json:"height,omitempty"` Alt string `googp:"og:image:alt" json:"alt,omitempty"` }
type OGP ¶
type OGP struct { Title string `googp:"og:title" json:"title,omitempty"` Type string `googp:"og:type" json:"type,omitempty"` URL string `googp:"og:url" json:"url,omitempty"` Images []Image `googp:"og:image" json:"images,omitempty"` Audios []Audio `googp:"og:audio" json:"audios,omitempty"` Description string `googp:"og:description" json:"description,omitempty"` Determiner string `googp:"og:determiner" json:"determiner,omitempty"` Locale string `googp:"og:locale" json:"locale,omitempty"` LocaleAlternate []string `googp:"og:locale:alternate" json:"locale_alternate,omitempty"` SiteName string `googp:"og:site_name" json:"site_name,omitempty"` Videos []Video `googp:"og:video" json:"videos,omitempty"` }
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
Parser is an OGP parser.
type ParserOpts ¶
type ParserOpts struct { // You can add processing when you need to regard the Node in the `<head>` as `<meta>`. // For example, you can use it when you want to get the `<title>`. PreNodeFunc func(*html.Node) *Meta // You can add body to parse target. // If html have some meta tags in the body, you should set to true. IncludeBody bool }
ParserOpts is option of `Parser`.
type Video ¶
type Video struct { URL string `googp:"og:video,og:video:url" json:"url,omitempty"` SecureURL string `googp:"og:video:secure_url" json:"secure_url,omitempty"` Type string `googp:"og:video:type" json:"type,omitempty"` Width int `googp:"og:video:width" json:"width,omitempty"` Height int `googp:"og:video:height" json:"height,omitempty"` }
Source Files
¶
Click to show internal directories.
Click to hide internal directories.