sources

package
v0.37.0 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2024 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Sources          = make(map[types.SourceType]Source)
	SourceURLRegexps = make(map[types.SourceType]*regexp.Regexp)
)

Functions

func FindSourceURL

func FindSourceURL(text string) string

func GetArtworkInfo

func GetArtworkInfo(sourceURL string) (*types.Artwork, error)

func GetFileName

func GetFileName(artwork *types.Artwork, picture *types.Picture) (string, error)

func GetPixivRegularURL

func GetPixivRegularURL(original string) string

func InitSources

func InitSources()

func MatchesSourceURL

func MatchesSourceURL(text string) bool

MatchesSourceURL returns whether the text contains a source URL.

Types

type Source

type Source interface {
	Init()
	FetchNewArtworksWithCh(artworkCh chan *types.Artwork, limit int) error
	FetchNewArtworks(limit int) ([]*types.Artwork, error)
	GetArtworkInfo(sourceURL string) (*types.Artwork, error)
	GetPictureInfo(sourceURL string, index uint) (*types.Picture, error)
	GetSourceURLRegexp() *regexp.Regexp
	// CommonSourceURl should has prefix "https://"
	GetCommonSourceURL(url string) string
	// FileName 返回图片的用于存储和传输的文件名
	GetFileName(artwork *types.Artwork, picture *types.Picture) string
	Config() *config.SourceCommonConfig
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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