opengraph

package
v0.0.0-...-7bc4eb1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 12, 2016 License: BSD-2-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Article

type Article struct {
	PublishedTime  *time.Time `json:"published_time"`
	ModifiedTime   *time.Time `json:"modified_time"`
	ExpirationTime *time.Time `json:"expiration_time"`
	Section        string     `json:"section"`
	Tags           []string   `json:"tags"`
	Authors        []*Profile `json:"authors"`
}

Article contain Open Graph Article structure

type Audio

type Audio struct {
	URL       string `json:"url"`
	SecureURL string `json:"secure_url"`
	Type      string `json:"type"`
}

Audio defines Open Graph Audio Type

type Book

type Book struct {
	ISBN        string     `json:"isbn"`
	ReleaseDate *time.Time `json:"release_date"`
	Tags        []string   `json:"tags"`
	Authors     []*Profile `json:"authors"`
}

Book contains Open Graph Book structure

type Image

type Image struct {
	URL       string `json:"url"`
	SecureURL string `json:"secure_url"`
	Type      string `json:"type"`
	Width     uint64 `json:"width"`
	Height    uint64 `json:"height"`
}

Image defines Open Graph Image type

type OpenGraph

type OpenGraph struct {
	Type             string   `json:"type"`
	URL              string   `json:"url"`
	Title            string   `json:"title"`
	Description      string   `json:"description"`
	Determiner       string   `json:"determiner"`
	SiteName         string   `json:"site_name"`
	Locale           string   `json:"locale"`
	LocalesAlternate []string `json:"locales_alternate"`
	Images           []*Image `json:"images"`
	Audios           []*Audio `json:"audios"`
	Videos           []*Video `json:"videos"`
	Article          *Article `json:"article,omitempty"`
	Book             *Book    `json:"book,omitempty"`
	Profile          *Profile `json:"profile,omitempty"`
	// contains filtered or unexported fields
}

OpenGraph contains facebook og data

func NewOpenGraph

func NewOpenGraph() *OpenGraph

NewOpenGraph returns new instance of Open Graph structure

func (*OpenGraph) ProcessHTML

func (og *OpenGraph) ProcessHTML(buffer io.Reader) error

ProcessHTML parses given html from Reader interface and fills up OpenGraph structure

func (*OpenGraph) ProcessMeta

func (og *OpenGraph) ProcessMeta(metaAttrs map[string]string)

ProcessMeta processes meta attributes and adds them to Open Graph structure if they are suitable for that

func (*OpenGraph) String

func (og *OpenGraph) String() string

String return json representation of structure, or error string

func (*OpenGraph) ToJSON

func (og *OpenGraph) ToJSON() ([]byte, error)

ToJSON a simple wrapper around json.Marshal

type Profile

type Profile struct {
	FirstName string `json:"first_name"`
	LastName  string `json:"last_name"`
	Username  string `json:"username"`
	Gender    string `json:"gender"`
}

Profile contains Open Graph Profile structure

type Video

type Video struct {
	URL       string `json:"url"`
	SecureURL string `json:"secure_url"`
	Type      string `json:"type"`
	Width     uint64 `json:"width"`
	Height    uint64 `json:"height"`
}

Video defines Open Graph Video type

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL