mangadex

package
v0.0.0-...-bd23c5e Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2025 License: GPL-3.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LanguageKey string = "tl-lang"
	// ScanlationGroupKey filter chapters on the group that translated it
	ScanlationGroupKey string = "scanlation_group"
	// AllowNonMatchingScanlationGroupKey if we should use chapters from groups not matching ScanlationGroupKey
	// Only takes effect if ScanlationGroupKey is set
	AllowNonMatchingScanlationGroupKey string = "allow_non_matching_scanlation_group"
)
View Source
const URL = "https://api.mangadex.org"

Variables

This section is empty.

Functions

func New

func New(scope *dig.Scope) core.Downloadable

Types

type Builder

type Builder struct {
	// contains filtered or unexported fields
}

func NewBuilder

func NewBuilder(log zerolog.Logger, httpClient *menou.Client, ps core.Client, repository Repository) *Builder

func (*Builder) Client

func (b *Builder) Client() services.Client

func (*Builder) DownloadMetadata

func (b *Builder) DownloadMetadata() payload.DownloadMetadata

func (*Builder) Logger

func (b *Builder) Logger() zerolog.Logger

func (*Builder) Normalize

func (b *Builder) Normalize(mangas *MangaSearchResponse) []payload.Info

func (*Builder) Provider

func (b *Builder) Provider() models.Provider

func (*Builder) Search

func (*Builder) Transform

func (b *Builder) Transform(s payload.SearchRequest) SearchOptions

type ChapterAttributes

type ChapterAttributes struct {
	Volume             string `json:"volume"`
	Chapter            string `json:"chapter"`
	Title              string `json:"title"`
	TranslatedLanguage string `json:"translatedLanguage"`
	ExternalUrl        string `json:"externalUrl"`
	PublishedAt        string `json:"publishedAt"`
	ReadableAt         string `json:"readableAt"`
	CreatedAt          string `json:"createdAt"`
	UpdatedAt          string `json:"updatedAt"`
	Pages              int    `json:"pages"`
	Version            int    `json:"version"`
}

type ChapterImageSearchResponse

type ChapterImageSearchResponse struct {
	Result  string      `json:"result"`
	BaseUrl string      `json:"baseUrl"`
	Chapter ChapterInfo `json:"chapter"`
}

func (*ChapterImageSearchResponse) FullImageUrls

func (s *ChapterImageSearchResponse) FullImageUrls() []string

FullImageUrls returns the urls for full quality

type ChapterInfo

type ChapterInfo struct {
	Hash      string   `json:"hash"`
	Data      []string `json:"data"`
	DataSaver []string `json:"dataSaver"`
}

type ChapterSearchData

type ChapterSearchData struct {
	Id            string            `json:"id"`
	Type          string            `json:"type"`
	Attributes    ChapterAttributes `json:"attributes"`
	Relationships []Relationship    `json:"relationships"`
}

func (ChapterSearchData) Chapter

func (chapter ChapterSearchData) Chapter() float64

func (ChapterSearchData) GetChapter

func (chapter ChapterSearchData) GetChapter() string

func (ChapterSearchData) GetId

func (chapter ChapterSearchData) GetId() string

func (ChapterSearchData) GetTitle

func (chapter ChapterSearchData) GetTitle() string

func (ChapterSearchData) GetVolume

func (chapter ChapterSearchData) GetVolume() string

func (ChapterSearchData) Volume

func (chapter ChapterSearchData) Volume() float64

type ChapterSearchResponse

type ChapterSearchResponse Response[[]ChapterSearchData]

type ContentRating

type ContentRating string
const (
	ContentRatingSafe         ContentRating = "safe"
	ContentRatingSuggestive   ContentRating = "suggestive"
	ContentRatingErotica      ContentRating = "erotica"
	ContentRatingPornographic ContentRating = "pornographic"
)

func (ContentRating) ComicInfoAgeRating

func (c ContentRating) ComicInfoAgeRating() comicinfo.AgeRating

func (ContentRating) MetronInfoAgeRating

func (c ContentRating) MetronInfoAgeRating() metroninfo.AgeRating

type Cover

type Cover struct {
	Bytes []byte
	Data  MangaCoverData
}

type CoverFactory

type CoverFactory func(volume string) (*Cover, bool)

type GetMangaResponse

type GetMangaResponse Response[MangaSearchData]

type MangaAttributes

type MangaAttributes struct {
	Title            map[string]string   `json:"title"`
	AltTitles        []map[string]string `json:"altTitles"`
	Description      map[string]string   `json:"description"`
	IsLocked         bool                `json:"isLocked"`
	Links            map[string]string   `json:"links"`
	OriginalLanguage string              `json:"originalLanguage"`
	LastVolume       string              `json:"lastVolume"`
	LastChapter      string              `json:"lastChapter"`
	Status           MangaStatus         `json:"status"`
	Year             int                 `json:"year"`
	ContentRating    ContentRating       `json:"contentRating"`
	Tags             []TagData           `json:"tags"`
}

func (*MangaAttributes) LangAltTitles

func (a *MangaAttributes) LangAltTitles(language string) []string

func (*MangaAttributes) LangDescription

func (a *MangaAttributes) LangDescription(language string) string

func (*MangaAttributes) LangTitle

func (a *MangaAttributes) LangTitle(language string) string

LangTitle returns the best guess English title for the manga In order of tries; Title(language), AltTitles(language), Title(any), Fixed string with non 0 length

type MangaCoverAttributes

type MangaCoverAttributes struct {
	Description string `json:"description"`
	Volume      string `json:"volume"`
	FileName    string `json:"fileName"`
	Locale      string `json:"locale"`
	CreatedAt   string `json:"createdAt"`
	UpdatedAt   string `json:"updatedAt"`
	Version     int    `json:"version"`
}

type MangaCoverData

type MangaCoverData struct {
	Id            string               `json:"id"`
	Type          string               `json:"type"`
	Attributes    MangaCoverAttributes `json:"attributes"`
	Relationships []Relationship       `json:"relationships"`
}

type MangaCoverResponse

type MangaCoverResponse Response[[]MangaCoverData]

type MangaSearchData

type MangaSearchData struct {
	Id            string          `json:"id"`
	Type          string          `json:"type"`
	Attributes    MangaAttributes `json:"attributes"`
	Relationships []Relationship  `json:"relationships"`

	Language string `json:"-"`
}

func (*MangaSearchData) AllChapters

func (a *MangaSearchData) AllChapters() []ChapterSearchData

func (*MangaSearchData) Artists

func (a *MangaSearchData) Artists() []string

func (*MangaSearchData) Authors

func (a *MangaSearchData) Authors() []string

func (*MangaSearchData) CoverURL

func (a *MangaSearchData) CoverURL() string
func (a *MangaSearchData) FormattedLinks() []string

func (*MangaSearchData) GetId

func (a *MangaSearchData) GetId() string

func (*MangaSearchData) GetTitle

func (a *MangaSearchData) GetTitle() string

func (*MangaSearchData) RefUrl

func (a *MangaSearchData) RefUrl() string

func (*MangaSearchData) ScanlationGroup

func (a *MangaSearchData) ScanlationGroup() []string

type MangaSearchResponse

type MangaSearchResponse Response[[]MangaSearchData]

type MangaStatus

type MangaStatus string
const (
	StatusOngoing   MangaStatus = "ongoing"
	StatusCompleted MangaStatus = "completed"
	StatusHiatus    MangaStatus = "hiatus"
	StatusCancelled MangaStatus = "cancelled"
)

type Relationship

type Relationship struct {
	Id         string         `json:"id"`
	Type       string         `json:"type"`
	Related    string         `json:"related,omitempty"`
	Attributes map[string]any `json:"attributes,omitempty"`
}

type Repository

type Repository interface {
	GetManga(ctx context.Context, id string) (*GetMangaResponse, error)
	SearchManga(ctx context.Context, options SearchOptions) (*MangaSearchResponse, error)
	GetChapters(ctx context.Context, id string, offset ...int) (*ChapterSearchResponse, error)
	GetChapterImages(ctx context.Context, id string) (*ChapterImageSearchResponse, error)
	GetCoverImages(ctx context.Context, id string, offset ...int) (*MangaCoverResponse, error)
}

func NewRepository

func NewRepository(params repositoryParams, log zerolog.Logger) Repository

type Response

type Response[T any] struct {
	Result   string `json:"result"`
	Response string `json:"response"`
	Data     T      `json:"data"`
	Limit    int    `json:"limit"`
	Offset   int    `json:"offset"`
	Total    int    `json:"total"`
}

type SearchOptions

type SearchOptions struct {
	Query                  string
	IncludedTags           []string
	ExcludedTags           []string
	Status                 []string
	ContentRating          []string
	PublicationDemographic []string
	SkipNotFoundTags       bool
}

type TagAttributes

type TagAttributes struct {
	Name          map[string]string `json:"name"`
	Description   map[string]string `json:"description"`
	Group         string            `json:"group"`
	Version       int               `json:"version"`
	Relationships []Relationship    `json:"relationships"`
}

type TagData

type TagData struct {
	Id         string        `json:"id"`
	Type       string        `json:"type"`
	Attributes TagAttributes `json:"attributes"`
}

type TagResponse

type TagResponse Response[[]TagData]

Jump to

Keyboard shortcuts

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