linkinfo

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

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

Go to latest
Published: Jan 5, 2017 License: MIT Imports: 13 Imported by: 0

README

linkinfo

Get enough info about URLs similar to what Facebook's scraper does for rendering previews

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ImageInfo

type ImageInfo struct {
	ImageUrl          string
	MimeType          string
	Width, Height     int
	LocalTempFilePath string
}

func GetImageInfo

func GetImageInfo(url, tmpDir string) (*ImageInfo, error)

func (*ImageInfo) Resize

func (ii *ImageInfo) Resize(sizes [][]int) ([]ImageInfo, error)

type Info

type Info struct {
	CanonicalUrl string
	Title        string
	Description  string
	SiteName     string
	Images       []ImageInfo
	Videos       []VideoInfo
}

func GetInfo

func GetInfo(url, tmpDir string) (*Info, error)

GetInfo scrapes the URL and makes a guess of what the URL contains. In particular, only one of the XYZInfo objects will be filled in based on what the url represents tmpDir is optional

type LinkInfo

type LinkInfo struct {
	RawUrl       string
	CanonicalUrl string
	Title        string
	Description  string
	SiteName     string
	ImageUrls    []string
	Videos       []VideoInfo
}

func ParseLinkInfo

func ParseLinkInfo(htmlData []byte, rawUrl string) (*LinkInfo, error)

type VideoInfo

type VideoInfo struct {
	VideoUrl string
	MimeType string
	Width    int
	Height   int
}

Jump to

Keyboard shortcuts

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