opengraph

package module
v0.0.0-...-a14f63d Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2024 License: MIT Imports: 14 Imported by: 0

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,omitempty"`
	URL              string           `json:"url,omitempty"`
	Title            string           `json:"title,omitempty"`
	Description      string           `json:"description,omitempty"`
	Determiner       string           `json:"determiner,omitempty"`
	SiteName         string           `json:"site_name,omitempty"`
	Locale           string           `json:"locale,omitempty"`
	LocalesAlternate []string         `json:"locales_alternate,omitempty"`
	Images           []*image.Image   `json:"images,omitempty"`
	Audios           []*audio.Audio   `json:"audios,omitempty"`
	Videos           []*video.Video   `json:"videos,omitempty"`
	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