blackbeard

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2022 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EpisodatePopulateEpisodesMetadata added in v0.0.4

func EpisodatePopulateEpisodesMetadata(show *Show)

Gets episode description from episodate api Fills in the episodes metadata of the show.Episodes array

func EpisodatePopulateShowMetadata added in v0.0.4

func EpisodatePopulateShowMetadata(show *Show)

Gets show description from episodate api Fills in the show metadata

func GetJson

func GetJson[T any](request Request, data T) T

Get Json request

func Keys added in v0.0.5

func Keys[K comparable, V any](m map[K]V) []K

Return list of keys of a map

func MergeMaps

func MergeMaps[K comparable, V any](maps ...map[K]V) map[K]V

func Perform

func Perform(request Request) (*http.Response, bool)

Perform a request using standart http

func SanitizeFilename added in v0.0.4

func SanitizeFilename(filename string) string

func ScrapePage

func ScrapePage(request Request, selector string, handler func(int, *goquery.Selection))

func Soup

func Soup(text string, selector string, handler func(int, *goquery.Selection))

Parses a string into a goquery selection object and call handler on it

func WrapString added in v0.0.4

func WrapString(s string, lim uint) string

WrapString wraps the given string within lim width in characters.

Wrapping is currently naive and only happens at white-space. A future version of the library will implement smarter wrapping. This means that pathological cases can dramatically reach past the limit, such as a very long word.

func WrapStringReguardlessly added in v0.0.4

func WrapStringReguardlessly(s string, width uint) string

Wrap reguardles of spaces

Types

type Episode

type Episode struct {
	Title    string
	Number   int
	Url      string
	Video    Video
	Metadata Metadata
}

type Metadata added in v0.0.4

type Metadata struct {
	Description  string
	ThumbnailUrl string
}

type Request

type Request struct {
	Url     string
	Method  string
	Headers map[string]string
	Body    map[string]string
	Curl    bool
}

func (Request) New added in v0.0.5

func (r Request) New(path string) Request

Create a new request from an existing one, appending to the url

type Show

type Show struct {
	Title    string
	Url      string
	Episodes []Episode
	Metadata Metadata
}

type Video

type Video struct {
	Name     string
	Format   string
	Request  Request
	Metadata Metadata
}

func (Video) Download

func (video Video) Download() bool

Downloads a video

type VideoProvider

type VideoProvider interface {
	SearchShows(string) []Show
	GetEpisodes(*Show) []Episode
	GetVideo(*Episode) Video
}

Jump to

Keyboard shortcuts

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