mangoprovider

package module
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: May 10, 2024 License: Unlicense Imports: 9 Imported by: 2

README

a logo depicting mango

ManGO Provider

Go Reference

Warning

The API is not stable and may change at any time.

Provider for libmangal written in go.

Most of the code/functionality is based heavily on implementations from Belphemur/mangal (which in turn comes from metafates/mangal) adapted to work with libmangal's mangal.

Credits

Mango logo: Mango icons created by max.icons - Flaticon

Documentation

Index

Constants

View Source
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

View Source
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(msg) when set, else it appends the message to the backlog. Once the logger is set, it logs all backlog on the next log.

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.

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

func (c *Chapter) MarshalJSON() ([]byte, error)

func (*Chapter) String added in v0.5.0

func (c *Chapter) String() string

func (*Chapter) Volume added in v0.5.0

func (c *Chapter) Volume() libmangal.Volume

type Filter added in v0.5.0

type Filter struct {
	NSFW                    bool
	Language                string
	MangaDexDataSaver       bool
	TitleChapterNumber      bool
	AvoidDuplicateChapters  bool
	ShowUnavailableChapters bool
}

func (*Filter) String added in v0.5.0

func (f *Filter) String() string

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 Headless added in v0.5.3

type Headless struct {
	UseFlaresolverr bool
	FlaresolverrURL string
}

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

func (*Loader) Load added in v0.5.3

func (l *Loader) Load(ctx context.Context) (libmangal.Provider, error)

func (*Loader) String added in v0.5.3

func (l *Loader) String() string

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"`

	AnilistSet_ bool                   `json:"-"`
	Anilist_    libmangal.AnilistManga `json:"-"`
}

func (*Manga) AnilistManga added in v0.7.4

func (m *Manga) AnilistManga() (libmangal.AnilistManga, error)

func (*Manga) Info added in v0.5.0

func (m *Manga) Info() libmangal.MangaInfo

func (*Manga) MarshalJSON added in v0.5.0

func (m *Manga) MarshalJSON() ([]byte, error)

func (*Manga) SeriesJSON added in v0.7.4

func (m *Manga) SeriesJSON() (libmangal.SeriesJSON, bool, error)

func (*Manga) SetAnilistManga added in v0.7.4

func (m *Manga) SetAnilistManga(anilist libmangal.AnilistManga)

func (*Manga) String added in v0.5.0

func (m *Manga) String() string

type Options added in v0.5.0

type Options struct {
	HTTPClient  *http.Client
	HTTPStore   func(providerID string) (gokv.Store, error)
	Parallelism uint8
	Headless
	Filter
}

type Page added in v0.5.0

type Page struct {
	Extension string            `json:"-"`
	URL       string            `json:"url"`
	Headers   map[string]string `json:"-"`
	Cookies   map[string]string `json:"-"`

	Chapter_ *Chapter `json:"-"`
}

func (*Page) Chapter added in v0.5.0

func (p *Page) Chapter() libmangal.Chapter

func (*Page) GetExtension added in v0.5.0

func (p *Page) GetExtension() string

func (*Page) String added in v0.5.0

func (p *Page) String() string

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 (p *Provider) ChapterPages(
	ctx context.Context,
	chapter libmangal.Chapter,
) ([]libmangal.Page, error)

func (*Provider) Close added in v0.5.0

func (p *Provider) Close() error

func (*Provider) GenericGetPageImage added in v0.5.0

func (p *Provider) GenericGetPageImage(
	ctx context.Context,
	page Page,
) ([]byte, error)

func (*Provider) GetPageImage added in v0.5.0

func (p *Provider) GetPageImage(
	ctx context.Context,
	page libmangal.Page,
) ([]byte, error)

func (*Provider) Info added in v0.5.0

func (p *Provider) Info() libmangal.ProviderInfo

func (*Provider) MangaVolumes added in v0.5.0

func (p *Provider) MangaVolumes(
	ctx context.Context,
	manga libmangal.Manga,
) ([]libmangal.Volume, error)

func (*Provider) SearchMangas added in v0.5.0

func (p *Provider) SearchMangas(
	ctx context.Context,
	query string,
) ([]libmangal.Manga, error)

func (*Provider) SetLogger added in v0.5.0

func (p *Provider) SetLogger(_logger *libmangal.Logger)

func (*Provider) String added in v0.5.0

func (p *Provider) String() string

func (*Provider) VolumeChapters added in v0.5.0

func (p *Provider) VolumeChapters(
	ctx context.Context,
	volume libmangal.Volume,
) ([]libmangal.Chapter, error)

type Volume added in v0.5.0

type Volume struct {
	Number float32 `json:"number"`

	Manga_ *Manga `json:"-"`
}

func (*Volume) Info added in v0.5.0

func (v *Volume) Info() libmangal.VolumeInfo

func (*Volume) Manga added in v0.5.0

func (v *Volume) Manga() libmangal.Manga

func (*Volume) MarshalJSON added in v0.5.0

func (v *Volume) MarshalJSON() ([]byte, error)

func (*Volume) String added in v0.5.0

func (v *Volume) String() string

Jump to

Keyboard shortcuts

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