malscraper

package module
Version: v1.2.20 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2021 License: MIT Imports: 11 Imported by: 2

README

Go-Malscraper

Github Test Coverage Go Report Card Go Reference

go-malscraper is just another unofficial API which scraping/parsing MyAnimeList website to a useful and easy-to-use data by using Go.

Well, it is created to help people get MyAnimeList data without relying on MyAnimeList since they limited/disabled/closed their API. It's working as long as the web is up and the UI design stays the same so it can get the page sources and parse them.

go-malscraper is using PuerkitoBio's HTML DOM parser and inspired by Jikan's API library and my PHP Mal-Scraper library.

Looking for REST API one? come here.

Features

  • Get anime information (details, characters, episodes, pictures, etc)
  • Get manga information (details, characters, pictures, recommendations, etc)
  • Get character information (details, pictures, etc)
  • Get people information (details, pictures, etc)
  • Get list of all anime/manga's genres
  • Get list of all anime/manga's producers/studios/licensors/magazines/serializations
  • Get anime/manga's recommendations
  • Get anime/manga's reviews
  • Search anime, manga, character and people
  • Get seasonal anime list
  • Get anime, manga, character and people top list
  • Get user information (profile, friends, histories, recommendations, reviews, etc)
  • Get news list and details
  • Get featured article list and details
  • Get club list and details
  • Caching

More will be coming soon...

Installation

go get github.com/rl404/go-malscraper

Quick Start

package main

import (
    "fmt"
    mal "github.com/rl404/go-malscraper"
)

func main() {
    // Init with default config.
    m, err := mal.NewDefault()
    if err != nil {
        // handle error
    }

    // Don't forget to close.
    defer m.Close()

    // Parse anime ID 1.
    d, _, err := m.GetAnime(1)
    if err != nil {
        // handle error
    }

    // Use.
    fmt.Println(d.Title)
}
With Configuration
m, err := mal.New(mal.Config{
    CacheTime:     24 * time.Hour,
    CleanImageURL: true,
    CleanVideoURL: true,
    LogLevel:      mal.LevelTrace,
    LogColor:      true,
})

For more detail config and usage, please go to the documentation.

Disclamer

go-malscraper is meant for educational purpose and personal usage only. Although there is no limit in using the API, do remember that every scraper method is accessing MyAnimeList page so use it responsibly according to MyAnimeList's Terms Of Service.

All data (including anime, manga, people, etc) and MyAnimeList logos belong to their respective copyrights owners. go-malscraper does not have any affiliation with content providers.

License

MIT License

Copyright (c) 2021 Axel

Documentation

Overview

Package malscraper provides methods to parse MyAnimeList web page.

Malscraper will get HTML body response, parse necessary information from the elements, clean them, and convert to golang model (struct) that can be used easily by other project/package. Malscraper is using "github.com/PuerkitoBio/goquery" package for parsing the HTML body.

// Init malscraper.
m, err := malscraper.NewDefault()
if err != nil {
 	// handle error
}

// Don't forget to close.
defer m.Close()

// Parse anime data.
anime, err := m.GetAnime(1)
if err != nil {
	// handle error
}

// Use anime data.
fmt.Println(anime.Title)

Caching

Malscraper provides caching system. As default, malscraper is using in-memory but it is recommended to use persistent cache such as redis. That's why malscraper allows you to create your own cacher which implements this interface. Or you can choose from `https://github.com/rl404/mal-plugin/tree/master/cache`.

type Cacher interface {
	Get(key string, data interface{}) error
	Set(key string, data interface{}) error
	Delete(key string) error
	Close() error
}

And use it when initiating malscraper.

m, err := malscraper.New(malscraper.Config{
	Cacher: yourCacher,
})

Logging

Logging is also interface so you can use your own logging.

type Logger interface {
	Trace(format string, args ...interface{})
	Debug(format string, args ...interface{})
	Info(format string, args ...interface{})
	Warn(format string, args ...interface{})
	Error(format string, args ...interface{})
	Fatal(format string, args ...interface{})
}

And use it when initiating malscraper.

m, err := malscraper.New(malscraper.Config{
	Logger: yourLogger,
})

Params

Some methods require specific value for the parameter. So, it is recommended to fill the parameter with provided constant to prevent unwanted errors.

m, err := malscraper.New(malscraper.Config{
	CacheTime:     24 * time.Hour,
	CleanImageURL: true,
	CleanVideoURL: true,
	LogLevel:      malscraper.LevelTrace,
	LogColor:      true,
})

m.GetRecommendation(malscraper.AnimeType, 1, 6)
m.GetSeason(malscraper.Winter, 2019)
m.GetTopAnime(malscraper.TopDefault, 2)

Error

Errors returned by methods are guaranteed from malscraper errors package. You should be able to handle the errors easier. The original errors (from the dependency package) can still be viewed through printed log (if you turn on error log level). All methods also return HTTP response code to help you distinguish the error.

Request Limit

All methods are requesting and accessing MyAnimeList web page so use them responsibly and don't spam too much or your ip will get banned or blacklisted. Recommended 1 request per 3 seconds and use caching. Or for more safety, 1 request per 5 seconds.

Index

Constants

View Source
const (
	LevelZero  = iota // no log
	LevelError        // error, fatal
	LevelInfo         // info, error, fatal
	LevelDebug        // debug, info, warning, error, fatal
	LevelTrace        // trace, debug, info, warning, error, fatal

	// Default level.
	LevelDefault = LevelError
)

Log level list. Used for initiating logger.

View Source
const (
	AllType = iota
	AnimeType
	MangaType
)

Main types.

View Source
const (
	Winter = "winter"
	Spring = "spring"
	Summer = "summer"
	Fall   = "fall"
)

Season list.

View Source
const (
	TopDefault = iota
	TopAiring
	TopUpcoming
	TopTV
	TopMovie
	TopOVA
	TopONA
	TopSpecial
	TopPopularAnime
	TopFavoriteAnime
)

Top anime types.

View Source
const (
	TopManga = iota + 1
	TopNovel
	TopOneshot
	TopDoujin
	TopManhwa
	TopManhua
	TopPopularManga
	TopFavoriteManga
)

Top manga types.

View Source
const (
	TypeDefault = iota
	TypeTV
	TypeOVA
	TypeMovie
	TypeSpecial
	TypeONA
	TypeMusic
)

Anime types.

View Source
const (
	TypeManga = iota + 1
	TypeLightNovel
	TypeOneShot
	TypeDoujinshi
	TypeManhwa
	TypeManhua

	TypeNovel
)

Manga types.

View Source
const (
	StatusOnGoing = iota + 1
	StatusFinished
	StatusUpcoming
	StatusHiatus       // manga only
	StatusDiscontinued // manga only
)

Anime & manga airing/publishing status.

View Source
const (
	RatingDefault = iota
	RatingG       // all ages
	RatingPG      // children
	RatingPG13    // teens 13 or older
	RatingR17     // 17+ (violence & profanity)
	RatingR       // mild nudity
	RatingRx      // hentai
)

Anime ratings.

View Source
const (
	StatusDefault = iota
	StatusCurrent
	StatusCompleted
	StatusOnHold
	StatusDropped

	StatusPlanned
	StatusAll
)

User list status.

View Source
const (
	OrderDefault = iota
	OrderAnimeTitle
	OrderAnimeFinishDate
	OrderAnimeStartDate
	OrderAnimeScore

	OrderAnimeType

	OrderAnimeRated

	OrderAnimePriority
	OrderAnimeProgress
	OrderAnimeStorage
	OrderAnimeAirStart
	OrderAnimeAirEnd
)

User anime list order.

View Source
const (
	OrderMangaTitle = iota + 1
	OrderMangaFinishDate
	OrderMangaStartDate
	OrderMangaScore

	OrderMangaPriority
	OrderMangaChapter
	OrderMangaVolume
	OrderMangaType
	OrderMangaPublishStart
	OrderMangaPublishEnd
)

User manga list order.

View Source
const (
	AnimeReview = iota
	MangaReview
	BestReview
)

Review types.

View Source
const (
	GenderDefault = iota
	GenderMale
	GenderFemale
	GenderNonBinary
)

Gender list.

View Source
const (
	AllCategory = iota
	AnimeCategory
	ConventionCategory
	ActorCategory
	CharacterCategory
	CompanyCategory
	GameCategory
	JapanCategory
	CityCategory
	MusicCategory
	MangaCategory
	SchoolCategory
	OtherCategory
)

Club categories.

View Source
const (
	SortDefault = iota
	SortName
	SortComment
	SortPost

	SortMember
)

Club sorts.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Cache interface with basic get & set functions.
	// Can use your own cacher interface.
	Cacher service.Cacher
	// Cache expired time. Will be used to initiating `Cacher`
	// using in-memory (bigcache) if `Cacher` is empty.
	CacheTime time.Duration

	// Does malscraper need to automatically clean any image and video url.
	// For more information, please read `ImageURLCleaner()` and `VideoURLCleaner()`
	// function in `pkg/utils/utils.go`.
	CleanImageURL bool
	CleanVideoURL bool

	// Log interface. Can use your own logger interface.
	Logger service.Logger
	// Log Level. Show only error as default. Value should be chosen from constant.
	// Will be used to intiating `Logger` if `Logger` is empty.
	LogLevel int
	// Colorful log. Will be used to intiating `Logger` if `Logger` is empty.
	LogColor bool
}

Config is malscraper configuration.

type Malscraper

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

Malscraper is malscraper instance which contains all methods to parse MyAnimeList web page.

func New

func New(cfg Config) (*Malscraper, error)

New to create new malscraper with config.

func NewDefault

func NewDefault() (*Malscraper, error)

NewDefault to quickly create new malscraper with default config. Will cache for 1 day as default.

func NewNoCache

func NewNoCache() (*Malscraper, error)

NewNoCache to create new malscraper without caching.

func (*Malscraper) AdvSearchAnime

func (m *Malscraper) AdvSearchAnime(query model.Query) ([]model.AnimeSearch, int, error)

AdvSearchAnime to search anime with advanced query.

Available constant options.

Type          Status           Rating
-----------   --------------   -------------
TypeDefault   StatusDefault    RatingDefault
TypeTV        StatusOnGoing    RatingG
TypeOVA       StatusFinished   RatingPG
TypeMovie     StatusUpcoming   RatingPG13
TypeSpecial                    RatingR17
TypeONA                        RatingR
TypeMusic                      RatingRx

ProducerID should be from `GetProducers()`.

GenreID should be from `GetAnimeGenres()`.

Example: https://myanimelist.net/anime.php?q=naruto.

func (*Malscraper) AdvSearchClub

func (m *Malscraper) AdvSearchClub(query model.ClubQuery) ([]model.ClubSearch, int, error)

AdvSearchClub to search club with advanced query.

Available constant options.

Category             Sort
------------------   -----------
AllCategory          SortDefault
AnimeCategory        SortName
ConventionCategory   SortComment
ActorCategory        SortPost
CharacterCategory    SortMember
CompanyCategory
GameCategory
JapanCategory
CityCategory
MusicCategory
MangaCategory
SchoolCategory
OtherCategory

Example: https://myanimelist.net/clubs.php?cat=club&catid=0&q=naruto&action=find.

func (*Malscraper) AdvSearchManga

func (m *Malscraper) AdvSearchManga(query model.Query) ([]model.MangaSearch, int, error)

AdvSearchManga to search manga with advanced query.

Available constant options.

Type             Status
-----------      --------------
TypeDefault      StatusDefault
TypeManga        StatusOnGoing
TypeLightNovel   StatusFinished
TypeOneShot      StatusUpcoming
TypeDoujinshi    StatusHiatus
TypeManhwa       StatusDiscontinued
TypeManhua
TypeNovel

MagazineID should be from `GetMagazines()`.

GenreID should be from `GetMangaGenres()`.

Example: https://myanimelist.net/manga.php?q=naruto.

func (*Malscraper) AdvSearchUser

func (m *Malscraper) AdvSearchUser(query model.UserQuery) ([]model.UserSearch, int, error)

AdvSearchUser to search user with advanced query.

Gender should be one of these constants.

GenderDefault
GenderMale
GenderFemale
GenderNonBinary

Example: https://myanimelist.net/users.php?q=rl404.

func (*Malscraper) Close

func (m *Malscraper) Close() error

Close to close cache connection if exists.

func (*Malscraper) GetAnime

func (m *Malscraper) GetAnime(id int) (*model.Anime, int, error)

GetAnime to get anime detail information.

Example: https://myanimelist.net/anime/1.

func (*Malscraper) GetAnimeArticle

func (m *Malscraper) GetAnimeArticle(id int) ([]model.ArticleItem, int, error)

GetAnimeArticle to get anime featured article list.

Example: https://myanimelist.net/anime/1/Cowboy_Bebop/featured.

func (*Malscraper) GetAnimeCharacter

func (m *Malscraper) GetAnimeCharacter(id int) ([]model.CharacterItem, int, error)

GetAnimeCharacter to get anime character list.

Example: https://myanimelist.net/anime/1/Cowboy_Bebop/characters.

func (*Malscraper) GetAnimeClub

func (m *Malscraper) GetAnimeClub(id int) ([]model.ClubItem, int, error)

GetAnimeClub to get anime club list.

Example: https://myanimelist.net/anime/1/Cowboy_Bebop/clubs.

func (*Malscraper) GetAnimeEpisode

func (m *Malscraper) GetAnimeEpisode(id int, page ...int) ([]model.Episode, int, error)

GetAnimeEpisode to get anime episode list.

Example: https://myanimelist.net/anime/1/Cowboy_Bebop/episode.

func (*Malscraper) GetAnimeGenres

func (m *Malscraper) GetAnimeGenres() ([]model.ItemCount, int, error)

GetAnimeGenres to get anime genre list.

Example: https://myanimelist.net/anime.php.

func (*Malscraper) GetAnimeMoreInfo

func (m *Malscraper) GetAnimeMoreInfo(id int) (string, int, error)

GetAnimeMoreInfo to get anime more info.

Example: https://myanimelist.net/anime/1/Cowboy_Bebop/moreinfo.

func (*Malscraper) GetAnimeNews

func (m *Malscraper) GetAnimeNews(id int) ([]model.NewsItem, int, error)

GetAnimeNews to get anime news list.

Example: https://myanimelist.net/anime/1/Cowboy_Bebop/news.

func (*Malscraper) GetAnimePicture

func (m *Malscraper) GetAnimePicture(id int) ([]string, int, error)

GetAnimePicture to get anime picture list.

Example: https://myanimelist.net/anime/1/Cowboy_Bebop/pics.

func (*Malscraper) GetAnimeRecommendation

func (m *Malscraper) GetAnimeRecommendation(id int) ([]model.Recommendation, int, error)

GetAnimeRecommendation to get anime recommendation list.

Example: https://myanimelist.net/anime/1/Cowboy_Bebop/userrecs

func (*Malscraper) GetAnimeRecommendations

func (m *Malscraper) GetAnimeRecommendations(page ...int) ([]model.Recommendation, int, error)

GetAnimeRecommendations to get anime recommendation list.

Example: https://myanimelist.net/recommendations.php?s=recentrecs&t=anime.

func (*Malscraper) GetAnimeReview

func (m *Malscraper) GetAnimeReview(id int, page ...int) ([]model.Review, int, error)

GetAnimeReview to get anime review list.

Example: https://myanimelist.net/anime/1/Cowboy_Bebop/reviews.

func (*Malscraper) GetAnimeReviews

func (m *Malscraper) GetAnimeReviews(page ...int) ([]model.Review, int, error)

GetAnimeReviews to get anime review list.

Example: https://myanimelist.net/reviews.php?t=anime.

func (*Malscraper) GetAnimeStaff

func (m *Malscraper) GetAnimeStaff(id int) ([]model.Role, int, error)

GetAnimeStaff to get anime staff list.

Example: https://myanimelist.net/anime/1/Cowboy_Bebop/characters.

func (*Malscraper) GetAnimeStats

func (m *Malscraper) GetAnimeStats(id int) (*model.Stats, int, error)

GetAnimeStats to get anime stats.

Example: https://myanimelist.net/anime/1/Cowboy_Bebop/stats.

func (*Malscraper) GetAnimeVideo

func (m *Malscraper) GetAnimeVideo(id int, page ...int) (*model.Video, int, error)

GetAnimeVideo to get anime video list.

Example: https://myanimelist.net/anime/1/Cowboy_Bebop/video.

func (*Malscraper) GetAnimeWithGenre

func (m *Malscraper) GetAnimeWithGenre(id int, page ...int) ([]model.AnimeItem, int, error)

GetAnimeWithGenre to get anime list with specific genre.

Example: https://myanimelist.net/anime/genre/1/Action.

func (*Malscraper) GetArticle

func (m *Malscraper) GetArticle(id int) (*model.Article, int, error)

GetArticle to get featured article detail information.

Example: https://myanimelist.net/featured/2321/Free_Manga_Service__Update__New_Anime_Titles.

func (*Malscraper) GetArticleTag

func (m *Malscraper) GetArticleTag() ([]model.ArticleTagItem, int, error)

GetArticleTag to get featured article tag list.

Example: https://myanimelist.net/featured/tag.

func (*Malscraper) GetArticles

func (m *Malscraper) GetArticles(pageTag ...interface{}) ([]model.ArticleItem, int, error)

GetArticles to get featured article list.

Tag should be from `GetArticleTag()`.

Example: https://myanimelist.net/featured.

func (*Malscraper) GetBestReviews

func (m *Malscraper) GetBestReviews(page ...int) ([]model.Review, int, error)

GetBestReviews to get best anime & manga review list.

Example: https://myanimelist.net/reviews.php?st=bestvoted.

func (*Malscraper) GetCharacter

func (m *Malscraper) GetCharacter(id int) (*model.Character, int, error)

GetCharacter to get character detail information.

Example: https://myanimelist.net/character/1/Spike_Spiegel.

func (*Malscraper) GetCharacterAnime

func (m *Malscraper) GetCharacterAnime(id int) ([]model.Role, int, error)

GetCharacterAnime to get character animeography list.

Example: https://myanimelist.net/character/1/Spike_Spiegel.

func (*Malscraper) GetCharacterArticle

func (m *Malscraper) GetCharacterArticle(id int) ([]model.ArticleItem, int, error)

GetCharacterArticle to get character featured article list.

Example: https://myanimelist.net/character/1/Spike_Spiegel/featured.

func (*Malscraper) GetCharacterClub

func (m *Malscraper) GetCharacterClub(id int) ([]model.ClubItem, int, error)

GetCharacterClub to get character club list.

Example: https://myanimelist.net/character/1/Spike_Spiegel/clubs.

func (*Malscraper) GetCharacterManga

func (m *Malscraper) GetCharacterManga(id int) ([]model.Role, int, error)

GetCharacterManga to get character mangaography list.

Example: https://myanimelist.net/character/1/Spike_Spiegel.

func (*Malscraper) GetCharacterOgraphy

func (m *Malscraper) GetCharacterOgraphy(_type int, id int) ([]model.Role, int, error)

GetCharacterOgraphy to get character animeography/mangaography list.

Param `_type` should be one of these constants.

AnimeType
MangaType

Or just use method `GetCharacterAnime()` or `GetCharacterManga()`.

func (*Malscraper) GetCharacterPicture

func (m *Malscraper) GetCharacterPicture(id int) ([]string, int, error)

GetCharacterPicture to get character picture list.

Example: https://myanimelist.net/character/1/Spike_Spiegel/pictures.

func (*Malscraper) GetCharacterVA added in v1.2.0

func (m *Malscraper) GetCharacterVA(id int) ([]model.Role, int, error)

GetCharacterVA to get character voice actor list.

Example: https://myanimelist.net/character/1/Spike_Spiegel.

func (*Malscraper) GetClub

func (m *Malscraper) GetClub(id int) (*model.Club, int, error)

GetClub to get club detail information.

Example: https://myanimelist.net/clubs.php?cid=1.

func (*Malscraper) GetClubMember

func (m *Malscraper) GetClubMember(id int, page ...int) ([]model.ClubMember, int, error)

GetClubMember to get club member list.

Example: https://myanimelist.net/clubs.php?action=view&t=members&id=1.

func (*Malscraper) GetClubPicture

func (m *Malscraper) GetClubPicture(id int) ([]string, int, error)

GetClubPicture to get club picture list.

Example: https://myanimelist.net/clubs.php?action=view&t=pictures&id=1.

func (*Malscraper) GetClubRelated

func (m *Malscraper) GetClubRelated(id int) (*model.ClubRelated, int, error)

GetClubRelated to get club related list.

Example: https://myanimelist.net/clubs.php?cid=1.

func (*Malscraper) GetClubs

func (m *Malscraper) GetClubs(page ...int) ([]model.ClubSearch, int, error)

GetClubs to get club list.

Example: https://myanimelist.net/clubs.php.

func (*Malscraper) GetGenres

func (m *Malscraper) GetGenres(_type int) ([]model.ItemCount, int, error)

GetGenres to get anime/manga genre list.

Param `_type` should be one of these constants.

AnimeType
MangaType

Or just use method `GetAnimeGenres()` or `GetMangaGenres()`.

func (*Malscraper) GetMagazine

func (m *Malscraper) GetMagazine(id int, page ...int) ([]model.MangaItem, int, error)

GetMagazine to get magazine manga list.

Example: https://myanimelist.net/manga/magazine/1/Big_Comic_Original.

func (*Malscraper) GetMagazines

func (m *Malscraper) GetMagazines() ([]model.ItemCount, int, error)

GetMagazines to get manga magazine/serialization list.

Example: https://myanimelist.net/manga/magazine.

func (*Malscraper) GetManga

func (m *Malscraper) GetManga(id int) (*model.Manga, int, error)

GetManga to get manga detail information.

Example: https://myanimelist.net/manga/1.

func (*Malscraper) GetMangaArticle

func (m *Malscraper) GetMangaArticle(id int) ([]model.ArticleItem, int, error)

GetMangaArticle to get manga featured article list.

Example: https://myanimelist.net/manga/1/Monster/featured.

func (*Malscraper) GetMangaCharacter

func (m *Malscraper) GetMangaCharacter(id int) ([]model.Role, int, error)

GetMangaCharacter to get manga character list.

Example: https://myanimelist.net/manga/1/Monster/characters.

func (*Malscraper) GetMangaClub

func (m *Malscraper) GetMangaClub(id int) ([]model.ClubItem, int, error)

GetMangaClub to get manga club list.

Example: https://myanimelist.net/manga/1/Monster/clubs.

func (*Malscraper) GetMangaGenres

func (m *Malscraper) GetMangaGenres() ([]model.ItemCount, int, error)

GetMangaGenres to get manga genre list.

Example: https://myanimelist.net/manga.php.

func (*Malscraper) GetMangaMoreInfo

func (m *Malscraper) GetMangaMoreInfo(id int) (string, int, error)

GetMangaMoreInfo to get manga more info.

Example: https://myanimelist.net/manga/2/Berserk/moreinfo.

func (*Malscraper) GetMangaNews

func (m *Malscraper) GetMangaNews(id int) ([]model.NewsItem, int, error)

GetMangaNews to get manga news list.

Example: https://myanimelist.net/manga/1/Monster/news.

func (*Malscraper) GetMangaPicture

func (m *Malscraper) GetMangaPicture(id int) ([]string, int, error)

GetMangaPicture to get manga picture list.

Example: https://myanimelist.net/manga/1/Monster/pics.

func (*Malscraper) GetMangaRecommendation

func (m *Malscraper) GetMangaRecommendation(id int) ([]model.Recommendation, int, error)

GetMangaRecommendation to get manga recommendation list.

Example: https://myanimelist.net/manga/1/Monster/userrecs.

func (*Malscraper) GetMangaRecommendations

func (m *Malscraper) GetMangaRecommendations(page ...int) ([]model.Recommendation, int, error)

GetMangaRecommendations to get manga recommendation list.

Example: https://myanimelist.net/recommendations.php?s=recentrecs&t=manga.

func (*Malscraper) GetMangaReview

func (m *Malscraper) GetMangaReview(id int, page ...int) ([]model.Review, int, error)

GetMangaReview to get manga review list.

Example: https://myanimelist.net/manga/1/Monster/reviews.

func (*Malscraper) GetMangaReviews

func (m *Malscraper) GetMangaReviews(page ...int) ([]model.Review, int, error)

GetMangaReviews to get manga review list.

Example: https://myanimelist.net/reviews.php?t=manga.

func (*Malscraper) GetMangaStats

func (m *Malscraper) GetMangaStats(id int) (*model.Stats, int, error)

GetMangaStats to get manga stats list.

Example: https://myanimelist.net/manga/1/Monster/stats.

func (*Malscraper) GetMangaWithGenre

func (m *Malscraper) GetMangaWithGenre(id int, page ...int) ([]model.MangaItem, int, error)

GetMangaWithGenre to get manga list with specific genre.

Example: https://myanimelist.net/manga/genre/1/Action.

func (*Malscraper) GetNews

func (m *Malscraper) GetNews(id int) (*model.News, int, error)

GetNews to get news detail information.

Example: https://myanimelist.net/news/34036779.

func (*Malscraper) GetNewsList

func (m *Malscraper) GetNewsList(pageTag ...interface{}) ([]model.NewsItem, int, error)

GetNewsList to get news list.

Tag should be from `GetNewsTag()`.

Example: https://myanimelist.net/news.

func (*Malscraper) GetNewsTag

func (m *Malscraper) GetNewsTag() (*model.NewsTag, int, error)

GetNewsTag to get news tag list.

Example: https://myanimelist.net/news/tag.

func (*Malscraper) GetPeople

func (m *Malscraper) GetPeople(id int) (*model.People, int, error)

GetPeople to get people detail information.

Example: https://myanimelist.net/people/1.

func (*Malscraper) GetPeopleArticle

func (m *Malscraper) GetPeopleArticle(id int) ([]model.ArticleItem, int, error)

GetPeopleArticle to get people featured article list.

Example: https://myanimelist.net/people/185/Kana_Hanazawa/featured.

func (*Malscraper) GetPeopleCharacter

func (m *Malscraper) GetPeopleCharacter(id int) ([]model.PeopleCharacter, int, error)

GetPeopleCharacter to get people anime character list.

Example: https://myanimelist.net/people/1.

func (*Malscraper) GetPeopleManga

func (m *Malscraper) GetPeopleManga(id int) ([]model.Role, int, error)

GetPeopleManga to get people published manga list.

Example: https://myanimelist.net/people/1868.

func (*Malscraper) GetPeopleNews

func (m *Malscraper) GetPeopleNews(id int) ([]model.NewsItem, int, error)

GetPeopleNews to get people news list.

Example: https://myanimelist.net/people/1/Tomokazu_Seki/news.

func (*Malscraper) GetPeoplePicture

func (m *Malscraper) GetPeoplePicture(id int) ([]string, int, error)

GetPeoplePicture to get people picture list.

Example: https://myanimelist.net/people/1/Tomokazu_Seki/pictures.

func (*Malscraper) GetPeopleStaff

func (m *Malscraper) GetPeopleStaff(id int) ([]model.Role, int, error)

GetPeopleStaff to get people anime staff list.

Example: https://myanimelist.net/people/1.

func (*Malscraper) GetProducer

func (m *Malscraper) GetProducer(id int, page ...int) ([]model.AnimeItem, int, error)

GetProducer to get producer anime list.

Example: https://myanimelist.net/anime/producer/1/Studio_Pierrot.

func (*Malscraper) GetProducers

func (m *Malscraper) GetProducers() ([]model.ItemCount, int, error)

GetProducers to get anime producer/studio/licensor list.

Example: https://myanimelist.net/anime/producer.

func (*Malscraper) GetRecommendation

func (m *Malscraper) GetRecommendation(_type int, id1, id2 int) (*model.Recommendation, int, error)

GetRecommendation to get anime/manga recommendation detail information.

Param `_type` should be one of these constants.

AnimeType
MangaType

Or just use method `GetRecommendationAnime()` or `GetRecommendationManga()`.

func (*Malscraper) GetRecommendationAnime

func (m *Malscraper) GetRecommendationAnime(id1, id2 int) (*model.Recommendation, int, error)

GetRecommendationAnime to get anime recommendation.

Example: https://myanimelist.net/recommendations/anime/1-205.

func (*Malscraper) GetRecommendationManga

func (m *Malscraper) GetRecommendationManga(id1, id2 int) (*model.Recommendation, int, error)

GetRecommendationManga to get manga recommendation.

Example: https://myanimelist.net/recommendations/manga/1-21.

func (*Malscraper) GetRecommendations

func (m *Malscraper) GetRecommendations(_type int, page ...int) ([]model.Recommendation, int, error)

GetRecommendations to get anime/manga recommendation list.

Param `_type` should be one of these constants.

AnimeType
MangaType

Or just use method `GetAnimeRecommendations()` or `GetMangaRecommendations()`.

func (*Malscraper) GetReview

func (m *Malscraper) GetReview(id int) (*model.Review, int, error)

GetReview to get review detail information.

Example: https://myanimelist.net/reviews.php?id=1.

func (*Malscraper) GetReviews

func (m *Malscraper) GetReviews(_type int, page ...int) ([]model.Review, int, error)

GetReviews to get anime/manga/best review list.

Param `_type` should be one of these constants.

AnimeReview
MangaReview
BestReview

Or just use method `GetAnimeReviews()`, `GetMangaReviews()` or `GetBestReviews()`.

func (*Malscraper) GetSeason

func (m *Malscraper) GetSeason(seasonYear ...interface{}) ([]model.AnimeItem, int, error)

GetSeason to get seasonal anime list.

Season should be one of these constants.

Winter
Spring
Summer
Fall

Example: https://myanimelist.net/anime/season.

func (*Malscraper) GetTopAnime

func (m *Malscraper) GetTopAnime(typePage ...int) ([]model.TopAnime, int, error)

GetTopAnime to get top anime list.

Type should be one of these constants.

TopDefault
TopAiring
TopUpcoming
TopTV
TopMovie
TopOVA
TopONA
TopSpecial
TopPopularAnime
TopFavoriteAnime

Example: https://myanimelist.net/topanime.php.

func (*Malscraper) GetTopCharacter

func (m *Malscraper) GetTopCharacter(page ...int) ([]model.TopCharacter, int, error)

GetTopCharacter to get top character list.

Example: https://myanimelist.net/character.php.

func (*Malscraper) GetTopManga

func (m *Malscraper) GetTopManga(typePage ...int) ([]model.TopManga, int, error)

GetTopManga to get top manga list.

Type should be one of these constants.

TopDefault
TopManga
TopNovel
TopOneshot
TopDoujin
TopManhwa
TopManhua
TopPopularManga
TopFavoriteManga

Example: https://mymangalist.net/topmanga.php.

func (*Malscraper) GetTopPeople

func (m *Malscraper) GetTopPeople(page ...int) ([]model.TopPeople, int, error)

GetTopPeople to get top people list.

Example: https://myanimelist.net/people.php.

func (*Malscraper) GetUser

func (m *Malscraper) GetUser(username string) (*model.User, int, error)

GetUser to get user detail information.

Example: https://myanimelist.net/profile/rl404.

func (*Malscraper) GetUserAnime

func (m *Malscraper) GetUserAnime(username string, page ...int) ([]model.UserAnime, int, error)

GetUserAnime to quick get user anime list.

Example: https://myanimelist.net/animelist/rl404.

func (*Malscraper) GetUserAnimeAdv

func (m *Malscraper) GetUserAnimeAdv(query model.UserListQuery) ([]model.UserAnime, int, error)

GetUserAnimeAdv to get user anime list.

Available constant options.

Status            Order
---------------   -------------------
StatusDefault     OrderDefault
StatusCurrent     OrderAnimeTitle
StatusCompleted   OrderAnimeFinishDate
StatusOnHold      OrderAnimeStartDate
StatusDropped     OrderAnimeScore
StatusPlanned     OrderAnimeType
StatusAll         OrderAnimeRated
                  OrderAnimePriority
                  OrderAnimeProgress
                  OrderAnimeStorage
                  OrderAnimeAirStart
                  OrderAnimeAirEnd

Example: https://myanimelist.net/animelist/rl404.

func (*Malscraper) GetUserClub

func (m *Malscraper) GetUserClub(username string) ([]model.Item, int, error)

GetUserClub to get user club list.

Example: https://myanimelist.net/profile/Archaeon/clubs.

func (*Malscraper) GetUserFavorite

func (m *Malscraper) GetUserFavorite(username string) (*model.UserFavorite, int, error)

GetUserFavorite to get user favorite list.

Example: https://myanimelist.net/profile/rl404.

func (*Malscraper) GetUserFriend

func (m *Malscraper) GetUserFriend(username string, page ...int) ([]model.UserFriend, int, error)

GetUserFriend to get user friend list.

Example: https://myanimelist.net/profile/rl404/friends.

func (*Malscraper) GetUserHistory

func (m *Malscraper) GetUserHistory(username string, _type ...int) ([]model.UserHistory, int, error)

GetUserHistory to get user history list.

Type should be one of these constants.

AllType
AnimeType
MangaType

Example: https://myanimelist.net/history/rl404.

func (*Malscraper) GetUserManga

func (m *Malscraper) GetUserManga(username string, page ...int) ([]model.UserManga, int, error)

GetUserManga to quick get user manga list.

Example: https://myanimelist.net/mangalist/rl404.

func (*Malscraper) GetUserMangaAdv

func (m *Malscraper) GetUserMangaAdv(query model.UserListQuery) ([]model.UserManga, int, error)

GetUserMangaAdv to get user manga list.

Available constant options.

Status            Order
---------------   -------------------
StatusDefault     OrderDefault
StatusCurrent     OrderMangaTitle
StatusCompleted   OrderMangaFinishDate
StatusOnHold      OrderMangaStartDate
StatusDropped     OrderMangaScore
StatusPlanned     OrderMangaPriority
StatusAll         OrderMangaChapter
                  OrderMangaVolume
                  OrderMangaType
                  OrderMangaPublishStart
                  OrderMangaPublishEnd

Example: https://myanimelist.net/mangalist/rl404.

func (*Malscraper) GetUserRecommendation

func (m *Malscraper) GetUserRecommendation(username string, page ...int) ([]model.Recommendation, int, error)

GetUserRecommendation to get user recommendation list.

Example: https://myanimelist.net/profile/Archaeon/recommendations.

func (*Malscraper) GetUserReview

func (m *Malscraper) GetUserReview(username string, page ...int) ([]model.Review, int, error)

GetUserReview to get user review list.

Example: https://myanimelist.net/profile/Archaeon/reviews.

func (*Malscraper) GetUserStats

func (m *Malscraper) GetUserStats(username string) (*model.UserStats, int, error)

GetUserStats to get user stats detail information.

Example: https://myanimelist.net/profile/rl404.

func (*Malscraper) SearchAnime

func (m *Malscraper) SearchAnime(title string, page ...int) ([]model.AnimeSearch, int, error)

SearchAnime to quick search anime.

Example: https://myanimelist.net/anime.php?q=naruto.

func (*Malscraper) SearchCharacter

func (m *Malscraper) SearchCharacter(name string, page ...int) ([]model.CharacterSearch, int, error)

SearchCharacter to search character.

Example: https://myanimelist.net/character.php?q=luffy.

func (*Malscraper) SearchClub

func (m *Malscraper) SearchClub(name string, page ...int) ([]model.ClubSearch, int, error)

SearchClub to quick search club.

Example: https://myanimelist.net/clubs.php?cat=club&catid=0&q=naruto&action=find.

func (*Malscraper) SearchManga

func (m *Malscraper) SearchManga(title string, page ...int) ([]model.MangaSearch, int, error)

SearchManga to quick search manga.

Example: https://myanimelist.net/manga.php?q=naruto.

func (*Malscraper) SearchPeople

func (m *Malscraper) SearchPeople(name string, page ...int) ([]model.PeopleSearch, int, error)

SearchPeople to search people.

Example: https://myanimelist.net/people.php?q=kana.

func (*Malscraper) SearchUser

func (m *Malscraper) SearchUser(username string, page ...int) ([]model.UserSearch, int, error)

SearchUser to quick search user.

Example: https://myanimelist.net/users.php?q=rl404.

Directories

Path Synopsis
Package errors contains all errors returned by malscraper.
Package errors contains all errors returned by malscraper.
Package model contains all models for malscraper.
Package model contains all models for malscraper.
pkg
utils
Package utils provides general helper functions for malscraper.
Package utils provides general helper functions for malscraper.

Jump to

Keyboard shortcuts

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