mgdex

package module
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: May 4, 2022 License: MIT Imports: 11 Imported by: 1

README

Go

mgdex

mgdex provides interfaces to get information as well as download chapters and manga from mangadex

Documentation

Overview

Package mgdex provides interfaces to get information as well as download chapters and manga from mangadex.

Index

Constants

View Source
const (
	// This constant specifies the limit number of image downloading at the same time. Since
	// too many downloads happen at a time can lead to timeout or network error.
	PAGE_LIMIT = 200
)

Variables

This section is empty.

Functions

func MangaQuery

func MangaQuery(id string) *mangaQuery

MangaQuery returns a query params builder

Types

type ChapterData

type ChapterData struct {
	Id         string
	Attributes struct {
		Volume             string
		Chapter            string
		Title              string
		TranslatedLanguage string
		Pages              uint
	}
	Relationships []map[string]interface{}
}

func GetChapter

func GetChapter(id string) (*ChapterData, error)

GetChapter send request to mangadex api and get back chapter data.

func (ChapterData) Download

func (chapter ChapterData) Download(dataSaver bool, path string) error

Download downloads the chapter and save to folder specified by 'path'. If 'path' is empty, current folder will be used.

func (ChapterData) DownloadAsZip

func (chapter ChapterData) DownloadAsZip(dataSaver bool, path string) error

DownloadAsZip downloads the chapter and save to zip file specified by 'path'.

func (ChapterData) GetChapter added in v0.2.0

func (chapter ChapterData) GetChapter() string

GetChapter returns chapter number of chapter, default is empty string.

func (ChapterData) GetId added in v0.2.0

func (chapter ChapterData) GetId() string

GetId returns chapter id

func (ChapterData) GetLanguage added in v0.2.0

func (chapter ChapterData) GetLanguage() string

GetLanguage returns language of chapter

func (ChapterData) GetMangaId added in v0.6.0

func (chapter ChapterData) GetMangaId() (string, error)

func (ChapterData) GetPageUrls

func (chapter ChapterData) GetPageUrls(dataSaver bool) ([]string, error)

GetPageUrls returns urls for all pages in the chapter.

func (ChapterData) GetPages added in v0.5.0

func (chapter ChapterData) GetPages() uint

GetPages returns number of pages in the chapter

func (ChapterData) GetScanlationGroup added in v0.2.0

func (chapter ChapterData) GetScanlationGroup() string

GetScanlationGroup returns scanlation group of chapter. Note that this requires an additional parameter in chapter request and the function GetChapter does not implements it. So this function is only useful with ChapterData gotten from manga query where includeGroup is enabled.

func (ChapterData) GetTitle added in v0.2.0

func (chapter ChapterData) GetTitle() string

GetTitle returns title of chapter, default is empty string.

func (ChapterData) GetVolume added in v0.2.0

func (chapter ChapterData) GetVolume() string

GetVolume returns volume number of chapter, default is empty string.

type ChapterList

type ChapterList []*ChapterData

func (ChapterList) Download

func (chapters ChapterList) Download(dataSaver bool, prefix string) bool

Method Download downloads list of chapters. They will be named with format <prefix><chapter_number>. 'prefix' can have parent folder, it will be created if not exist.

func (ChapterList) DownloadAsZip

func (chapters ChapterList) DownloadAsZip(dataSaver bool, prefix string, ext string) bool

Method Download downloads list of chapters and zip them. They will be named with format <prefix><chapter_number>.<ext>. 'prefix' can have parent folder, it will be created if not exist.

type MangaData

type MangaData struct{ Data []ChapterData }

MangaData represents data of manga gotten from manga feed api of mangadex. It does not include information of author, artist,... since it only serves the purpose of getting chapters data

func (*MangaData) Append added in v0.4.0

func (m1 *MangaData) Append(m2 *MangaData)

Append adds chapter data from m2 to m1

func (MangaData) Filter

func (manga MangaData) Filter() *mangaFilter

Filter returns a pointer to mangaFilter with default values. It works in a builder manner.

func (MangaData) Length added in v0.4.0

func (manga MangaData) Length() int

Length returns number of chapters in manga data

type MangaInfo added in v0.6.0

type MangaInfo struct {
	Id         string
	Attributes struct {
		Title       map[string]string
		AltTitles   []map[string]string
		Description map[string]string
		Status      string
		Year        int
		// contains filtered or unexported fields
	}
}

func GetMangaInfo added in v0.6.0

func GetMangaInfo(id string) (*MangaInfo, error)

GetMangaInfo returns manga information (GET manga/{id})

func (*MangaInfo) GetAllTitles added in v0.6.0

func (manga *MangaInfo) GetAllTitles() []map[string]string

GetAllTitles returns all titles in all languages

func (*MangaInfo) GetMainTitle added in v0.6.0

func (manga *MangaInfo) GetMainTitle() string

GetMainTitle returns the title in the main manga page

func (*MangaInfo) GetTitles added in v0.6.0

func (manga *MangaInfo) GetTitles(lang string) []string

GetTitles returns all titles in a specific language

Directories

Path Synopsis
Pakage imgdl provides functions to download one or multiple image asynchronousely.
Pakage imgdl provides functions to download one or multiple image asynchronousely.

Jump to

Keyboard shortcuts

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