tohru

package module
v0.0.0-...-73d6a12 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2022 License: GPL-3.0 Imports: 12 Imported by: 3

README

tohru


tohru is an Go Anslayer API wrapper

Documentation

Index

Constants

View Source
const (
	PublishedAnimesPath = "anime/public/animes/get-published-animes"
	GetAnimeDetailsPath = "anime/public/anime/get-anime-details"
)
View Source
const (
	GetEpisodePath      = "/anime/public/episodes/get-episodes-new"
	EpisodeDownloadPath = "/la/public/api/fw"
	BackupLinksPath     = "/anime/public/v-qs.php"
)
View Source
const (
	CustomList              listType = "custom_list"
	AnimeList               listType = "anime_list"
	CurrentlyAiring         listType = "currently_airing"
	LatestUpdatedEpisode    listType = "latest_updated_episode"
	LatestUpdatedEpisodeNew listType = "latest_updated_episode_new"
	TopAnime                listType = "top_anime"
	TopCurrentlyAiring      listType = "top_currently_airing"
	TopTv                   listType = "top_tv"
	TopMovie                listType = "top_movie"
	Featured                listType = "featured"
	Filter                  listType = "filter"
	Favoirtes               listType = "watching"
	PlanToWatch             listType = "plan_to_watch"
	Watched                 listType = "watched"
	Dropped                 listType = "dropped"
	OnHold                  listType = "on_hold"
	WatchedHistory          listType = "watched_history"
	Schedule                listType = "schedule"
	LastAddedTv             listType = "last_added_tv"
	LastAddedMovie          listType = "last_added_movie"
	TopAnimeMal             listType = "top_anime_mal"
	CurrentlyAiringMal      listType = "top_currently_airing_mal"
	TopTvMal                listType = "top_tv_mal"
	AnimeCharacters         listType = "anime_characters"
	TopUpcoming             listType = "top_upcoming"
)
View Source
const (
	AnimeNameAsc  order = "anime_name_asc"
	AnimeNameDesc order = "anime_name_desc"
	AnimeYearAsc  order = "anime_year_asc"
	AnimeYearDesc order = "anime_year_desc"
	LatestFirst   order = "latest_first"
	EarlierFirst  order = "earliest_first"
	RatingDesc    order = "anime_rating_desc"
)
View Source
const (
	Fall   season = "Fall"
	Summer season = "Summer"
	Winter season = "Winter"
	Spring season = "Spring"
)
View Source
const (
	BaseAPI = "https://anslayer.com"
)

Variables

View Source
var (
	ErrBackupLink = fmt.Errorf("error while getting backup links")
)

Functions

This section is empty.

Types

type Anime

type Anime struct {
	AnimeID            string `json:"anime_id"`
	AnimeName          string `json:"anime_name"`
	AnimeType          string `json:"anime_type"`
	AnimeStatus        string `json:"anime_status"`
	JustInfo           string `json:"just_info"`
	AnimeSeason        string `json:"anime_season"`
	AnimeReleaseYear   string `json:"anime_release_year"`
	AnimeRating        string `json:"anime_rating"`
	LatestEpisodeID    string `json:"latest_episode_id"`
	LatestEpisodeName  string `json:"latest_episode_name"`
	AnimeGenres        string `json:"anime_genres"`
	AnimeCoverImageURL string `json:"anime_cover_image_url"`
	AnimeTrailerURL    string `json:"anime_trailer_url"`
	AnimeReleaseDay    string `json:"anime_release_day"`
}

type AnimeDetails

type AnimeDetails struct {
	AnimeID              string               `json:"anime_id"`
	AnimeName            string               `json:"anime_name"`
	AnimeType            string               `json:"anime_type"`
	AnimeStatus          string               `json:"anime_status"`
	AnimeSeason          string               `json:"anime_season"`
	AnimeReleaseYear     string               `json:"anime_release_year"`
	AnimeAgeRating       string               `json:"anime_age_rating"`
	AnimeRating          string               `json:"anime_rating"`
	AnimeRatingUserCount string               `json:"anime_rating_user_count"`
	AnimeDescription     string               `json:"anime_description"`
	AnimeCoverImage      string               `json:"anime_cover_image"`
	AnimeTrailerURL      string               `json:"anime_trailer_url"`
	AnimeEnglishTitle    string               `json:"anime_english_title"`
	AnimeKeywords        string               `json:"anime_keywords"`
	AnimeUpdatedAt       string               `json:"anime_updated_at"`
	AnimeCreatedAt       string               `json:"anime_created_at"`
	AnimeGenreIds        string               `json:"anime_genre_ids"`
	AnimeGenres          string               `json:"anime_genres"`
	AnimeReleaseDay      string               `json:"anime_release_day"`
	AnimeCoverImageURL   string               `json:"anime_cover_image_url"`
	AnimeUpdatedAtFormat string               `json:"anime_updated_at_format"`
	AnimeCreatedAtFormat string               `json:"anime_created_at_format"`
	MoreInfoResult       moreInfoResult       `json:"more_info_result"`
	RelatedAnimes        interface{}          `json:"related_animes"`
	RelatedNews          interface{}          `json:"related_news"`
	CommentFlagReasons   []commentFlagReasons `json:"comment_flag_reasons"`
	ContentRating        []contentRating      `json:"content_rating"`
	Role                 string               `json:"role"`
}

func (*AnimeDetails) UnmarshalJSON

func (ad *AnimeDetails) UnmarshalJSON(b []byte) error

UnmarshalJSON Implements a custom marsheler Because API have bad design and need to check edge cases

type AnimeService

type AnimeService service

func (*AnimeService) CustomAnimePayload

func (s *AnimeService) CustomAnimePayload(payload JsonPayload) ([]Anime, error)

func (*AnimeService) GetAnimeDetails

func (s *AnimeService) GetAnimeDetails(animeID int) (AnimeDetails, error)

func (*AnimeService) GetAnimeListBySeason

func (s *AnimeService) GetAnimeListBySeason(offset, limit int, season season, orderBy order, releaseYear int) ([]Anime, error)

func (*AnimeService) GetLatestAnimes

func (s *AnimeService) GetLatestAnimes(offset, limit int) ([]Anime, error)

func (*AnimeService) OrderBy

func (s *AnimeService) OrderBy(offset, limit int, orderBy order) ([]Anime, error)

func (*AnimeService) SearchByName

func (s *AnimeService) SearchByName(offset, limit int, animeName string, orderBy order) ([]Anime, error)
type BackupLinks []struct {
	File  string `json:"file"`
	Label string `json:"label"`
}

type Config

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

func NewConfig

func NewConfig(clientID, clientSecret, backupLinksSecret string) *Config

type DownloadInfo

type DownloadInfo struct {
	EpisodeHostLink           string
	EpisodeDirectDownloadLink string
}

type DownloadInfos

type DownloadInfos []DownloadInfo
type DownloadLinks []string

type Episode

type Episode struct {
	EpisodeID                 string        `json:"episode_id"`
	EpisodeName               string        `json:"episode_name"`
	EpisodeNumber             string        `json:"episode_number"`
	AllowComment              string        `json:"allow_comment"`
	SkipFrom                  string        `json:"skip_from"`
	SkipTo                    string        `json:"skip_to"`
	EpisodeRating             string        `json:"episode_rating"`
	EpisodeRatingUserCount    string        `json:"episode_rating_user_count"`
	EpisodeWatchedHistory     interface{}   `json:"episode_watched_history"`
	EpisodeAlreadyRatedByUser interface{}   `json:"episode_already_rated_by_user"`
	EpisodeRatingByUser       interface{}   `json:"episode_rating_by_user"`
	EpisodeUrls               []episodeUrls `json:"episode_urls"`
	NextEpisode               []nextEpisode `json:"next_episode"`
	PreviousEpisode           []interface{} `json:"previous_episode"`
}

type EpisodeService

type EpisodeService service
func (s *EpisodeService) GetBackupLinks(animeName string, episodeNb int) (DownloadInfos, error)

func (*EpisodeService) GetDirectDownloadInfos

func (s *EpisodeService) GetDirectDownloadInfos(animeName string, episodeNb int) (DownloadInfos, error)

func (*EpisodeService) GetDirectDownloadInfosWithMax

func (s *EpisodeService) GetDirectDownloadInfosWithMax(animeName string, episodeNb int, maxNbOfLinks int) (DownloadInfos, error)
func (s *EpisodeService) GetDownloadLinks(animeName string, episodeNb int) (DownloadLinks, error)

func (*EpisodeService) GetEpisodeDetails

func (s *EpisodeService) GetEpisodeDetails(animeID, episodeID int) (Episode, error)

func (*EpisodeService) GetEpisodesList

func (s *EpisodeService) GetEpisodesList(animeID int) ([]Episode, error)

func (*EpisodeService) GetFirstDirectDownloadInfo

func (s *EpisodeService) GetFirstDirectDownloadInfo(animeName string, episodeNb int) (DownloadInfo, error)

type JsonPayload

type JsonPayload map[string]interface{}

func (*JsonPayload) ToJson

func (p *JsonPayload) ToJson() (string, error)

func (*JsonPayload) WithAnimeId

func (p *JsonPayload) WithAnimeId(id int) error

func (*JsonPayload) WithEpisodeId

func (p *JsonPayload) WithEpisodeId(id int) error

func (*JsonPayload) WithJustInfo

func (p *JsonPayload) WithJustInfo(info string) error

func (*JsonPayload) WithLimit

func (p *JsonPayload) WithLimit(limit int) error

func (*JsonPayload) WithListType

func (p *JsonPayload) WithListType(l listType) error

func (*JsonPayload) WithN

func (p *JsonPayload) WithN(animeName string, episodeNb int) error

func (*JsonPayload) WithName

func (p *JsonPayload) WithName(name string)

func (*JsonPayload) WithOffset

func (p *JsonPayload) WithOffset(offset int) error

func (*JsonPayload) WithOrder

func (p *JsonPayload) WithOrder(o order) error

func (*JsonPayload) WithReleaseYear

func (p *JsonPayload) WithReleaseYear(year int) error

func (*JsonPayload) WithSeason

func (p *JsonPayload) WithSeason(s season) error

type News

type News struct {
	NewsID              string      `json:"news_id"`
	AnimeID             string      `json:"anime_id"`
	AnimeName           string      `json:"anime_name"`
	NewsTitle           string      `json:"news_title"`
	NewsDescription     string      `json:"news_description"`
	NewsDescriptionHTML interface{} `json:"news_description_html"`
	NewsImage           string      `json:"news_image"`
	NewsSourceLink      string      `json:"news_source_link"`
	NewsVideoLink       string      `json:"news_video_link"`
	NewsPublished       string      `json:"news_published"`
	NewsCreatedAt       string      `json:"news_created_at"`
	NewsUpdatedAt       interface{} `json:"news_updated_at"`
	NewsImageURL        string      `json:"news_image_url"`
	NewsUpdatedAtFormat string      `json:"news_updated_at_format"`
	NewsCreatedAtFormat string      `json:"news_created_at_format"`
}

type RelatedAnimes

type RelatedAnimes struct {
	Animes []Anime `json:"data"`
}

type RelatedNews

type RelatedNews struct {
	Data []News `json:"data"`
}

type TohruClient

type TohruClient struct {
	AnimeService   *AnimeService
	EpisodeService *EpisodeService
	// contains filtered or unexported fields
}

func NewTohruClient

func NewTohruClient(cfg *Config) *TohruClient

Jump to

Keyboard shortcuts

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