grabber

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2024 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Chapter added in v0.0.3

type Chapter struct {
	// Title is the chapter title
	Title string
	// Number is the chapter number
	Number float64
	// PagesCount is the number of pages in the chapter
	PagesCount int64
	// Pages is the list of pages in the chapter
	Pages []Page
	// Language is the chapter language
	Language string
}

Chapter represents a manga chapter

func (Chapter) GetNumber added in v0.0.3

func (c Chapter) GetNumber() float64

GetNumber returns the chapter number

func (Chapter) GetTitle added in v0.0.3

func (c Chapter) GetTitle() string

GetTitle returns the chapter title removing whitespace and newlines

type Enumerable added in v0.0.3

type Enumerable interface {
	GetNumber() float64
}

Enumerable represents an object that can be enumerated

type Filterable added in v0.0.3

type Filterable interface {
	Enumerable
	Titleable
}

Filterable represents an filterable objects

type Filterables added in v0.0.3

type Filterables []Filterable

Filterables represents a slice of Filterable

func (Filterables) Filter added in v0.0.3

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

Filter allows to filter Filterables by the given condition

func (Filterables) FilterRanges added in v0.0.3

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

FilterRanges returns the specified ranges of Filterables sorted by their Number

func (Filterables) SortByNumber added in v0.0.3

func (f Filterables) SortByNumber() Filterables

SortByNumber sorts Filterables by Number

type Grabber added in v0.0.3

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

func (g Grabber) BaseUrl() string

BaseUrl returns the base url of the site

func (Grabber) GetFilenameTemplate added in v0.0.6

func (g Grabber) GetFilenameTemplate() string

GetFilenameTemplate returns the defined filename template

func (Grabber) GetMaxConcurrency added in v0.0.5

func (g Grabber) GetMaxConcurrency() MaxConcurrency

GetMaxConcurrency returns the max concurrency for the site

func (Grabber) GetPreferredLanguage added in v0.0.5

func (g Grabber) GetPreferredLanguage() string

GetPreferredLanguage returns the preferred language for the site

func (*Grabber) IdentifySite added in v0.0.3

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

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

func (*Grabber) InitFlags added in v0.0.5

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

InitFlags initializes the command flags

func (*Grabber) SetMaxConcurrency added in v0.0.5

func (g *Grabber) SetMaxConcurrency(m MaxConcurrency)

SetMaxConcurrency sets the max concurrency for the site

type Inmanga added in v0.0.6

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

Inmanga is a grabber for inmanga.com

func (Inmanga) FetchChapter added in v0.0.6

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

FetchChapter fetches the chapter with its pages

func (Inmanga) FetchChapters added in v0.0.6

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

FetchChapters returns the chapters of the manga

func (*Inmanga) FetchTitle added in v0.0.6

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

GetTitle fetches the manga title

func (*Inmanga) Test added in v0.0.6

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

Test checks if the site is InManga

type InmangaChapter added in v0.0.6

type InmangaChapter struct {
	Chapter
	Id string
}

InmangaChapter is a chapter representation from InManga

type Mangadex added in v0.0.6

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

Mangadex is a grabber for mangadex.org

func (Mangadex) FetchChapter added in v0.0.6

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

FetchChapter fetches a chapter and its pages

func (Mangadex) FetchChapters added in v0.0.6

func (m Mangadex) FetchChapters() (chapters Filterables, errs []error)

FetchChapters returns the chapters of the manga

func (*Mangadex) FetchTitle added in v0.0.6

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

GetTitle returns the title of the manga

func (*Mangadex) Test added in v0.0.6

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

Test checks if the site is MangaDex

type MangadexChapter added in v0.0.6

type MangadexChapter struct {
	Chapter
	Id string
}

MangadexChapter represents a MangaDex Chapter

type MaxConcurrency added in v0.0.5

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

type Page struct {
	// Number is the page number
	Number int64
	// URL is the page URL
	URL string
}

Page represents a chapter page

type PlainHTML added in v0.0.11

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

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

FetchChapter fetches a chapter and its pages

func (PlainHTML) FetchChapters added in v0.0.11

func (m PlainHTML) FetchChapters() (chapters Filterables, errs []error)

FetchChapters returns a slice of chapters

func (PlainHTML) FetchTitle added in v0.0.11

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

Ttitle returns the manga title

func (*PlainHTML) Test added in v0.0.11

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

Test returns true if the URL is a valid grabber URL

type PlainHTMLChapter added in v0.0.11

type PlainHTMLChapter struct {
	Chapter
	URL string
}

PlainHTMLChapter represents a PlainHTML Chapter

type Settings added in v0.0.7

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

type Site interface {
	// InitFlags initializes the command flags
	InitFlags(cmd *cobra.Command)
	// Test tests if the site is the one for the specified url
	Test() (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(url string, settings *Settings) (Site, []error)

NewSite returns a new site based on the passed url

type SiteSelector added in v0.0.11

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

type Tcb added in v0.0.4

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

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

func (Tcb) FetchChapter added in v0.0.4

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

FetchChapter fetches a chapter and its pages

func (Tcb) FetchChapters added in v0.0.4

func (t Tcb) FetchChapters() (chapters Filterables, errs []error)

FetchChapters returns a slice of chapters

func (*Tcb) FetchTitle added in v0.0.6

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

GetTitle fetches and returns the manga title

func (*Tcb) Test added in v0.0.4

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

Test returns true if the URL is a compatible TCBScans URL

type TcbChapter added in v0.0.4

type TcbChapter struct {
	Chapter
	URL string
}

TcbChapter is a chapter for TCBScans

type Titleable added in v0.0.3

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