opengraph

package module
v0.0.0-...-606d7b1 Latest Latest
Warning

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

Go to latest
Published: May 24, 2022 License: MIT Imports: 14 Imported by: 357

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

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.Image   `json:"images"`
	Audios           []*audio.Audio   `json:"audios"`
	Videos           []*video.Video   `json:"videos"`
	Article          *article.Article `json:"article,omitempty"`
	Book             *book.Book       `json:"book,omitempty"`
	Profile          *profile.Profile `json:"profile,omitempty"`
	Music            *music.Music     `json:"music,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

Directories

Path Synopsis
types

Jump to

Keyboard shortcuts

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