Documentation
¶
Index ¶
- Constants
- Variables
- func Log(msg string)
- type Chapter
- type Filter
- type Functions
- type Headless
- type Loader
- type Manga
- type Options
- type Page
- type Provider
- func (p *Provider) ChapterPages(ctx context.Context, chapter libmangal.Chapter) ([]libmangal.Page, error)
- func (p *Provider) Close() error
- func (p *Provider) GenericGetPageImage(ctx context.Context, page Page) ([]byte, error)
- func (p *Provider) GetPageImage(ctx context.Context, page libmangal.Page) ([]byte, error)
- func (p *Provider) Info() libmangal.ProviderInfo
- func (p *Provider) MangaVolumes(ctx context.Context, manga libmangal.Manga) ([]libmangal.Volume, error)
- func (p *Provider) SearchMangas(ctx context.Context, query string) ([]libmangal.Manga, error)
- func (p *Provider) SetLogger(_logger *libmangal.Logger)
- func (p *Provider) String() string
- func (p *Provider) VolumeChapters(ctx context.Context, volume libmangal.Volume) ([]libmangal.Chapter, error)
- type Volume
Constants ¶
const ( BundleID = "mango" UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36" )
Variables ¶
var ImageExtensionRegex = regexp.MustCompile(`^\.[a-zA-Z0-9][a-zA-Z0-9.]*[a-zA-Z0-9]$`)
Functions ¶
func Log ¶ added in v0.5.3
func Log(msg string)
Log calls (*libmangal.Logger).Log() which is set by libmangal via Provider.SetLogger.
It is the logger created by libmangal and used internally. Mangal also plugs into the logger (via (*libmangal.Client).Logger()) and uses it for info display.
It can also be set anywhere else, but usually it's something libmangal manages and since the Provider implementation handles the "setup" we can intercept it and use externally (like here in mangoprovider).
The logger is set once the provider is loaded, meaning that it will not be available for scraper/scraper.go for example, but it will for scraper/search_mangas.go as by that point the provider has been loaded.
TODO: provider mangal zerologger and use it when the *libmangal.Logger isn't available?
Types ¶
type Chapter ¶ added in v0.5.0
type Chapter struct { Title string `json:"title"` ID string `json:"id"` URL string `json:"url"` Number float32 `json:"number"` Date libmangal.Date `json:"date"` ScanlationGroup string `json:"scanlation_group"` Volume_ *Volume `json:"-"` }
func (Chapter) Info ¶ added in v0.5.0
func (c Chapter) Info() libmangal.ChapterInfo
func (Chapter) MarshalJSON ¶ added in v0.5.0
type Filter ¶ added in v0.5.0
type Functions ¶ added in v0.5.3
type Functions struct { SearchMangas func(context.Context, gokv.Store, string) ([]libmangal.Manga, error) MangaVolumes func(context.Context, gokv.Store, Manga) ([]libmangal.Volume, error) VolumeChapters func(context.Context, gokv.Store, Volume) ([]libmangal.Chapter, error) ChapterPages func(context.Context, gokv.Store, Chapter) ([]libmangal.Page, error) GetPageImage func(context.Context, Page) ([]byte, error) }
type Loader ¶ added in v0.5.3
type Loader struct { libmangal.ProviderInfo Options Options F func() Functions // So that the scrapers are loaded on ProviderLoader.Load(ctx) }
func (Loader) Info ¶ added in v0.5.3
func (l Loader) Info() libmangal.ProviderInfo
type Manga ¶ added in v0.5.0
type Manga struct { Title string `json:"title"` AnilistSearch string `json:"anilist_search"` URL string `json:"url"` ID string `json:"id"` Cover string `json:"cover"` Banner string `json:"banner"` }
func (Manga) MarshalJSON ¶ added in v0.5.0
type Page ¶ added in v0.5.0
type Page struct { Extension string `json:"extension"` URL string `json:"url"` Headers map[string]string `json:"headers"` Cookies map[string]string `json:"cookies"` Chapter_ *Chapter `json:"-"` }
func (Page) GetExtension ¶ added in v0.5.0
type Provider ¶ added in v0.5.0
type Provider struct { libmangal.ProviderInfo Options Options F Functions // contains filtered or unexported fields }
func (*Provider) ChapterPages ¶ added in v0.5.0
func (*Provider) GenericGetPageImage ¶ added in v0.5.0
func (*Provider) GetPageImage ¶ added in v0.5.0
func (*Provider) Info ¶ added in v0.5.0
func (p *Provider) Info() libmangal.ProviderInfo
func (*Provider) MangaVolumes ¶ added in v0.5.0
func (*Provider) SearchMangas ¶ added in v0.5.0
type Volume ¶ added in v0.5.0
func (Volume) Info ¶ added in v0.5.0
func (v Volume) Info() libmangal.VolumeInfo