linkinfo

package module
v0.0.0-...-9ae4527 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2019 License: ISC Imports: 18 Imported by: 0

README

LinkInfo

Build Status

An API/Library to get link information (Title, Description, etc)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ByteCountBinary

func ByteCountBinary(b int64) string

func ByteCountDecimal

func ByteCountDecimal(b int64) string

Types

type HttpOptions

type HttpOptions struct {
	Option

	UserAgent string
}

type ImgurInfoApi

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

func (*ImgurInfoApi) Handler

func (i *ImgurInfoApi) Handler(link string) (*LinkInfo, error)

type ImgurOptions

type ImgurOptions struct {
	Option

	ClientId string
}

type LinkHandler

type LinkHandler struct {
	Hosts   []string
	Handler func(link string) (*LinkInfo, error)
}

type LinkInfo

type LinkInfo struct {
	Title         string   `json:"title"`
	Description   string   `json:"description"`
	ContentType   string   `json:"type"`
	ContentLength int64    `json:"contentLength"`
	Duration      string   `json:"duration,omitempty"`
	Redirects     []string `json:"redirects,omitempty"`
}

type LinkInfoApi

type LinkInfoApi struct {
	Client    *http.Client
	UserAgent string

	Imgur   *ImgurInfoApi
	Youtube *YoutubeInfoApi
	Twitter *TwitterInfoApi
	// contains filtered or unexported fields
}

func New

func New(opts ...Option) *LinkInfoApi

func (*LinkInfoApi) AddHandler

func (i *LinkInfoApi) AddHandler(handler *LinkHandler)

func (*LinkInfoApi) DefaultLinkHandler

func (api *LinkInfoApi) DefaultLinkHandler(link string) (*LinkInfo, error)

func (*LinkInfoApi) Retrieve

func (i *LinkInfoApi) Retrieve(link string) (*LinkInfo, error)

type Option

type Option interface {
}

type TwitterInfoApi

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

func (*TwitterInfoApi) Handler

func (i *TwitterInfoApi) Handler(link string) (*LinkInfo, error)

func (*TwitterInfoApi) Init

func (i *TwitterInfoApi) Init()

type TwitterOptions

type TwitterOptions struct {
	Option

	ConsumerKey    string
	ConsumerSecret string
	Token          string
	TokenSecret    string
}

type YoutubeInfoApi

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

func (*YoutubeInfoApi) Handler

func (i *YoutubeInfoApi) Handler(link string) (*LinkInfo, error)

type YoutubeOptions

type YoutubeOptions struct {
	Option

	Key string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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