Documentation
¶
Index ¶
- Variables
- func NewRequest(url string) (*http.Request, error)
- func ParseDate(ds string) (t time.Time, err error)
- func ParseDateP(ds string) *time.Time
- type Article
- type Audio
- type Image
- type Link
- type Meta
- func (meta *Meta) Contribute(p *Page) (err error)
- func (meta *Meta) IsArticleAuthor() bool
- func (meta *Meta) IsArticleModifiedTime() bool
- func (meta *Meta) IsArticlePublishedTime() bool
- func (meta *Meta) IsArticlePublisher() bool
- func (meta *Meta) IsArticleSection() bool
- func (meta *Meta) IsAuthor() bool
- func (meta *Meta) IsDescription() bool
- func (meta *Meta) IsKeywords() bool
- func (meta *Meta) IsOGAudio() bool
- func (meta *Meta) IsOGDescription() bool
- func (meta *Meta) IsOGImage() bool
- func (meta *Meta) IsOGLocale() bool
- func (meta *Meta) IsOGSiteName() bool
- func (meta *Meta) IsOGTitle() bool
- func (meta *Meta) IsOGType() bool
- func (meta *Meta) IsOGURL() bool
- func (meta *Meta) IsOGUpdatedTime() bool
- func (meta *Meta) IsOGVideo() bool
- func (meta *Meta) IsPropertyOf(name string) bool
- type OpenGraph
- type Page
- type Video
Constants ¶
This section is empty.
Variables ¶
var ( Client = http.DefaultClient DefaultHeaders = map[string]string{ "Accept": "text/html", "Accept-Encoding": "gzip", "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:109.0) Gecko/20100101 Firefox/111.0", } )
var DateFormats = []string{}/* 126 elements not displayed */
DateFormats taken from github.com/mjibson/goread
var DateFormatsWithNamedZone = []string{
"Mon, January 02, 2006, 15:04:05 MST",
"Mon, January 02, 2006 15:04:05 MST",
"Mon, Jan 2, 2006 15:04 MST",
"Mon, Jan 2 2006 15:04 MST",
"Mon, Jan 2, 2006 15:04:05 MST",
"Mon Jan 2 15:04:05 2006 MST",
"Mon, Jan 02,2006 15:04:05 MST",
"Monday, January 2, 2006 15:04:05 MST",
"Monday, 2 January 2006 15:04:05 MST",
"Monday, 2 Jan 2006 15:04:05 MST",
"Monday, 02 January 2006 15:04:05 MST",
"Mon, 2 January 2006 15:04 MST",
"Mon, 2 January 2006, 15:04:05 MST",
"Mon, 2 January 2006 15:04:05 MST",
"Mon, 2 Jan 2006 15:4:5 MST",
"Mon, 2 Jan 2006 15:04 MST",
"Mon, 2 Jan 2006 15:04:05MST",
"Mon, 2 Jan 2006 15:04:05 MST",
"Mon 2 Jan 2006 15:04:05 MST",
"mon,2 Jan 2006 15:04:05 MST",
"Mon, 2 Jan 15:04:05 MST",
"Mon, 2 Jan 06 15:04:05 MST",
"Mon,02 January 2006 14:04:05 MST",
"Mon, 02 Jan 2006 3:04:05 PM MST",
"Mon,02 Jan 2006 15:04 MST",
"Mon, 02 Jan 2006 15:04 MST",
"Mon, 02 Jan 2006, 15:04:05 MST",
"Mon, 02 Jan 2006 15:04:05MST",
"Mon, 02 Jan 2006 15:04:05 MST",
"Mon , 02 Jan 2006 15:04:05 MST",
"Mon, 02 Jan 06 15:04:05 MST",
"January 2, 2006 15:04:05 MST",
"January 02, 2006 15:04:05 MST",
"Jan 2, 2006 3:04:05 PM MST",
"Jan 2, 2006 15:04:05 MST",
"2 January 2006 15:04:05 MST",
"2 Jan 2006 15:04:05 MST",
"2006-01-02 15:04:05 MST",
"1/2/2006 3:04:05 PM MST",
"1/2/2006 15:04:05 MST",
"02 Jan 2006 15:04 MST",
"02 Jan 2006 15:04:05 MST",
"02/01/2006 15:04 MST",
"02-01-2006 15:04:05 MST",
"01/02/2006 15:04:05 MST",
}
DateFormatsWithNamedZone Named zone cannot be consistently loaded, so handle separately
Functions ¶
func ParseDate ¶
ParseDate parses a given date string using a large list of commonly found feed date formats.
func ParseDateP ¶
Types ¶
type Audio ¶
type Audio struct { URL string `json:"url,omitempty"` SecureURL string `json:"secure_url,omitempty"` Type string `json:"type,omitempty"` // Content-Type }
Audio represents a structure of "og:audio". "og:audio" might have following properties:
- og:audio:url
- og:audio:secure_url
- og:audio:type
type Image ¶
type Image struct { URL string `json:"url,omitempty"` SecureURL string `json:"secure_url,omitempty"` Type string `json:"type,omitempty"` // Content-Type Width int `json:"width,omitempty"` Height int `json:"height,omitempty"` Alt string `json:"alt,omitempty"` }
Image represents a structure of "og:image". "og:image" might have following properties:
- og:image:url
- og:image:secure_url
- og:image:type
- og:image:width
- og:image:height
- og:image:alt
type Link ¶
func (*Link) Contribute ¶
type Meta ¶
func (*Meta) Contribute ¶
func (*Meta) IsArticleAuthor ¶
IsArticleAuthor returns if it can be "article:author"
func (*Meta) IsArticleModifiedTime ¶
IsArticleModifiedTime returns if it can be "article:modified_time"
func (*Meta) IsArticlePublishedTime ¶
IsArticlePublishedTime returns if it can be "article:published_time"
func (*Meta) IsArticlePublisher ¶
IsArticlePublisher returns if it can be "article:publisher"
func (*Meta) IsArticleSection ¶
IsArticleSection returns if it can be "article:section"
func (*Meta) IsDescription ¶
IsDescription returns if it can be "description".
func (*Meta) IsKeywords ¶
IsKeywords returns if it can be "keywords".
func (*Meta) IsOGDescription ¶
IsOGDescription returns if it can be "description" of OGP
func (*Meta) IsOGLocale ¶
IsOGLocale returns if it can be "og:locale"
func (*Meta) IsOGSiteName ¶
IsOGSiteName returns if it can be "og:site_name"
func (*Meta) IsOGUpdatedTime ¶
IsOGUpdatedTime returns if it can be "og:updated_time"
func (*Meta) IsPropertyOf ¶
IsPropertyOf returns if it can be a property of specified struct
type OpenGraph ¶
type OpenGraph struct { Title string `json:"title,omitempty"` Type string `json:"type,omitempty"` URL string `json:"url,omitempty"` Description string `json:"description,omitempty"` Locale string `json:"locale,omitempty"` SiteName string `json:"site_name,omitempty"` UpdatedTime *time.Time `json:"updated_time,omitempty"` Video []Video `json:"video,omitempty"` Image []Image `json:"image,omitempty"` Audio []Audio `json:"audio,omitempty"` }
type Page ¶
type Page struct { URL string `json:"url,omitempty"` Title string `json:"title,omitempty"` Description string `json:"description,omitempty"` Keywords string `json:"keywords,omitempty"` Author string `json:"author,omitempty"` Favicon []string `json:"favicon,omitempty"` OpenGraph *OpenGraph `json:"open_graph,omitempty"` Article *Article `json:"article,omitempty"` }
type Video ¶
type Video struct { URL string `json:"url,omitempty"` SecureURL string `json:"secure_url,omitempty"` Type string `json:"type,omitempty"` // Content-Type Width int `json:"width,omitempty"` Height int `json:"height,omitempty"` // Duration in seconds Duration int `json:"duration,omitempty"` Tag []string `json:"tag,omitempty"` }
Video represents a structure of "og:video". "og:video" might have following properties:
- og:video:url
- og:video:secure_url
- og:video:type
- og:video:width
- og:video:height
- og:video:tag