url2oembed

package
v0.0.0-...-af364a0 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2017 License: MIT Imports: 16 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type OembedRedirectGoodError

type OembedRedirectGoodError struct {
	// contains filtered or unexported fields
}

OembedRedirectGoodError is a hack to stop following redirects and get oembed resource

func (*OembedRedirectGoodError) Error

func (orge *OembedRedirectGoodError) Error() string

func (*OembedRedirectGoodError) GetItem

func (orge *OembedRedirectGoodError) GetItem() *oembed.Item

GetItem return embed item

func (*OembedRedirectGoodError) GetURL

func (orge *OembedRedirectGoodError) GetURL() string

GetURL returns url of resource with embeding implemented

type Parser

type Parser struct {
	AcceptLanguage    string
	UserAgent         string
	MaxHTMLBodySize   int64
	MaxBinaryBodySize int64
	WaitTimeout       time.Duration

	// list of IP addresses to blacklist
	BlacklistedIPNetworks []*net.IPNet

	// list of IP addresses to whitelist
	WhitelistedIPNetworks []*net.IPNet
	// contains filtered or unexported fields
}

Parser implements an url parsing code

func NewParser

func NewParser(oe *oembed.Oembed) *Parser

NewParser returns new Parser instance Oembed pointer is optional, it just speeds up information gathering

func (*Parser) Dial

func (p *Parser) Dial(network, addr string) (net.Conn, error)

Dial is used to disable access to blacklisted IP addresses

func (*Parser) FetchOembedFromHTML

func (p *Parser) FetchOembedFromHTML(pageURL string, data []byte, contentType string) *oembed.Info

FetchOembedFromHTML returns information extracted from html page

func (*Parser) Parse

func (p *Parser) Parse(u string) *oembed.Info

Parse parses an url and returns structurized representation

Jump to

Keyboard shortcuts

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