Documentation ¶
Overview ¶
Package mgdex provides interfaces to get information as well as download chapters and manga from mangadex.
Index ¶
- Constants
- func MangaQuery(id string) *mangaQuery
- type ChapterData
- func (chapter ChapterData) Download(dataSaver bool, path string) error
- func (chapter ChapterData) DownloadAsZip(dataSaver bool, path string) error
- func (chapter ChapterData) GetChapter() string
- func (chapter ChapterData) GetId() string
- func (chapter ChapterData) GetLanguage() string
- func (chapter ChapterData) GetMangaId() (string, error)
- func (chapter ChapterData) GetPageUrls(dataSaver bool) ([]string, error)
- func (chapter ChapterData) GetPages() uint
- func (chapter ChapterData) GetScanlationGroup() string
- func (chapter ChapterData) GetTitle() string
- func (chapter ChapterData) GetVolume() string
- type ChapterList
- type MangaData
- type MangaInfo
Constants ¶
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 ¶
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
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
GetMangaInfo returns manga information (GET manga/{id})
func (*MangaInfo) GetAllTitles ¶ added in v0.6.0
GetAllTitles returns all titles in all languages
func (*MangaInfo) GetMainTitle ¶ added in v0.6.0
GetMainTitle returns the title in the main manga page