grabber

package
v0.0.0-...-2c9135b Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2024 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Chapter

type Chapter struct {
	Title      string
	Number     float64
	PagesCount int64
	Pages      []Page
	Language   string
}

Chapter represents a manga chapter

func (Chapter) GetNumber

func (c Chapter) GetNumber() float64

GetNumber returns the chapter number

func (Chapter) GetTitle

func (c Chapter) GetTitle() string

GetTitle returns the chapter title removing whitespace and newlines

type Enumerable

type Enumerable interface {
	GetNumber() float64
}

Enumerable represents an object that can be enumerated

type Filterable

type Filterable interface {
	Enumerable
	Titleable
}

Filterable represents an filterable objects

type Filterables

type Filterables []Filterable

Filterables represents a slice of Filterable

func (Filterables) Filter

func (f Filterables) Filter(cond func(Filterable) bool) Filterables

Filter allows to filter Filterables by the given condition

func (Filterables) FilterRanges

func (f Filterables) FilterRanges(rngs []ranges.Range) Filterables

FilterRanges returns the specified ranges of Filterables sorted by their Number

func (Filterables) SortByNumber

func (f Filterables) SortByNumber() Filterables

SortByNumber sorts Filterables by Number

type Grabber

type Grabber struct {
	// URL is the manga index URL
	URL string
	// Settings are the grabber settings
	Settings *Settings
}

Grabber is the base struct for all grabbers/sites

func (Grabber) BaseURL

func (g Grabber) BaseURL() string

BaseURL returns the base url of the site

func (Grabber) GetFilenameTemplate

func (g Grabber) GetFilenameTemplate() string

GetFilenameTemplate returns the defined filename template

func (Grabber) GetMaxConcurrency

func (g Grabber) GetMaxConcurrency() MaxConcurrency

GetMaxConcurrency returns the max concurrency for the site

func (Grabber) GetPreferredLanguage

func (g Grabber) GetPreferredLanguage() string

GetPreferredLanguage returns the preferred language for the site

func (*Grabber) IdentifySite

func (g *Grabber) IdentifySite() (Site, []error)

IdentifySite returns the site passing the ValidateURL() for the specified url

func (*Grabber) InitFlags

func (g *Grabber) InitFlags(cmd *cobra.Command)

InitFlags initializes the command flags

func (*Grabber) SetMaxConcurrency

func (g *Grabber) SetMaxConcurrency(m MaxConcurrency)

SetMaxConcurrency sets the max concurrency for the site

type Inmanga

type Inmanga struct {
	*Grabber
	// contains filtered or unexported fields
}

Inmanga is a grabber for inmanga.com

func (Inmanga) FetchChapter

func (i Inmanga) FetchChapter(chap Filterable) (*Chapter, error)

FetchChapter fetches the chapter with its pages

func (Inmanga) FetchChapters

func (i Inmanga) FetchChapters() (Filterables, error)

FetchChapters returns the chapters of the manga

func (*Inmanga) FetchTitle

func (i *Inmanga) FetchTitle() (string, error)

GetTitle fetches the manga title

func (*Inmanga) ValidateURL

func (i *Inmanga) ValidateURL() (bool, error)

ValidateURL checks if the site is InManga

type InmangaChapter

type InmangaChapter struct {
	Chapter
	Id string
}

InmangaChapter is a chapter representation from InManga

type Mangadex

type Mangadex struct {
	*Grabber
	// contains filtered or unexported fields
}

Mangadex is a grabber for mangadex.org

func (Mangadex) FetchChapter

func (m Mangadex) FetchChapter(f Filterable) (*Chapter, error)

FetchChapter fetches a chapter and its pages

func (Mangadex) FetchChapters

func (m Mangadex) FetchChapters() (Filterables, error)

FetchChapters returns the chapters of the manga

func (*Mangadex) FetchTitle

func (m *Mangadex) FetchTitle() (string, error)

FetchTitle returns the title of the manga

func (*Mangadex) ValidateURL

func (m *Mangadex) ValidateURL() (bool, error)

ValidateURL checks if the site is MangaDex

type MangadexChapter

type MangadexChapter struct {
	Chapter
	ID string
}

MangadexChapter represents a MangaDex Chapter

type MaxConcurrency

type MaxConcurrency struct {
	// Chapters is the max concurrency for chapters
	Chapters uint8
	// Pages is the max concurrency for pages
	Pages uint8
}

MaxConcurrency is the max concurrency for a site

type Page

type Page struct {
	Number int64
	URL    string
}

Page represents a chapter page

type PlainHTML

type PlainHTML struct {
	*Grabber
	// contains filtered or unexported fields
}

PlainHTML is a grabber for any plain HTML page (with no ajax pagination whatsoever)

func (PlainHTML) FetchChapter

func (m PlainHTML) FetchChapter(f Filterable) (*Chapter, error)

FetchChapter fetches a chapter and its pages

func (PlainHTML) FetchChapters

func (m PlainHTML) FetchChapters() (Filterables, error)

FetchChapters returns a slice of chapters

func (PlainHTML) FetchTitle

func (m PlainHTML) FetchTitle() (string, error)

Ttitle returns the manga title

func (*PlainHTML) ValidateURL

func (m *PlainHTML) ValidateURL() (bool, error)

ValidateURL returns true if the URL is a valid grabber URL

type PlainHTMLChapter

type PlainHTMLChapter struct {
	Chapter
	URL string
}

PlainHTMLChapter represents a PlainHTML Chapter

type Settings

type Settings struct {
	// Bundle is a flag to indicate if the chapters should be bundled into a single file
	Bundle bool
	// MaxConcurrency determines max download concurrency
	MaxConcurrency MaxConcurrency
	// Language is the preferred language for downloading chapters
	Language string
	// FilenameTemplate is the template for the filename
	FilenameTemplate string
	// Range is the range to be downloaded (in string, i.e. "1-10,23,45-50")
	Range string
	// OutputDir is the output directory for the downloaded files
	OutputDir string
}

Settings are grabber settings

type Site

type Site interface {
	// InitFlags initializes the command flags
	InitFlags(cmd *cobra.Command)
	// Test tests if the site is the one for the specified url
	ValidateURL() (bool, error)
	// FetchChapters fetches the chapters for the manga
	FetchChapters() (Filterables, error)
	// FetchChapter fetches the specified chapter
	FetchChapter(Filterable) (*Chapter, error)
	// FetchTitle fetches the manga title
	FetchTitle() (string, error)
	// BaseURL returns the base url of the site
	BaseURL() string
	// GetFilenameTemplate returns the filename template
	GetFilenameTemplate() string
	// GetMaxConcurrency returns the max concurrency for the site
	GetMaxConcurrency() MaxConcurrency
	// GetPreferredLanguage returns the preferred language for the site
	GetPreferredLanguage() string
}

Site is the handler interface, base of all manga sites grabbers

func NewSite

func NewSite(siteURL string, settings *Settings) (Site, []error)

NewSite returns a new site based on the passed url

type SiteSelector

type SiteSelector struct {
	Title        string
	Rows         string
	Link         string
	Chapter      string
	ChapterTitle string
	Image        string
}

type Tcb

type Tcb struct {
	*Grabber
	// contains filtered or unexported fields
}

Tcb is a grabber for tcbscans.com (and possibly other wordpress sites)

func (Tcb) FetchChapter

func (t Tcb) FetchChapter(f Filterable) (*Chapter, error)

FetchChapter fetches a chapter and its pages

func (Tcb) FetchChapters

func (t Tcb) FetchChapters() (chapters Filterables, err error)

FetchChapters returns a slice of chapters

func (*Tcb) FetchTitle

func (t *Tcb) FetchTitle() (string, error)

FetchTitle fetches and returns the manga title

func (*Tcb) ValidateURL

func (t *Tcb) ValidateURL() (bool, error)

ValidateURL returns true if the URL is a compatible TCBScans URL

type TcbChapter

type TcbChapter struct {
	Chapter
	URL string
}

TcbChapter is a chapter for TCBScans

type Titleable

type Titleable interface {
	GetTitle() string
}

Titleable represents an object that can be titled

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳