home

package
v0.0.0-...-1bc3864 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Handler gin.HandlerFunc = func(ctx *gin.Context) {
	data, err := scrapeHomePage()
	if err != nil {
		log.Println(err)

		if config.IsHttpError(err) {
			config.HandleErr(ctx, err.(*config.HttpError))
			return
		}

		config.HandleErr(ctx, config.NewHttpError(500))
		return
	}

	ctx.JSON(200, data)
}

Functions

This section is empty.

Types

type AllGenres

type AllGenres struct {
	Status `json:"status"`
	Result []Genre `json:"result"`
}

type CommonAnimeResult

type CommonAnimeResult struct {
	IDNumber         int          `json:"id_number"`
	MalID            int          `json:"mal_id,omitempty"`
	Name             string       `json:"name"`
	NameEnglish      string       `json:"name_english"`
	Slug             string       `json:"slug"`
	Overview         string       `json:"overview,omitempty"`
	Type             *interface{} `json:"type"`
	CountryCode      string       `json:"country_code"`
	PosterPath       string       `json:"poster_path"`
	BackdropPath     string       `json:"backdrop_path,omitempty"`
	TotalEpisodes    int          `json:"total_episodes"`
	LatestEpisodeSub *int         `json:"latest_episode_sub"` // using pointer to have "null" in json
	LatestEpisodeDub *int         `json:"latest_episode_dub"`
	AiringStatus     int          `json:"airing_status"`
	AiredFrom        string       `json:"aired_from,omitempty"`
	Runtime          int          `json:"runtime"`
	RatingType       *interface{} `json:"rating_type"`
	Genres           []Genre      `json:"genres"`
	ID               string       `json:"id"`
	TotalViewTop     int          `json:"totalViewTop,omitempty"`
}

NOTE: using *interface{} to have "null" in json, because default value of string is ""

type Genre

type Genre struct {
	ID   int    `json:"id"`
	Name string `json:"name"`
	Slug string `json:"slug"`
}

type HomePageParser

type HomePageParser struct {
	Resp ScrapedHomePage
	// contains filtered or unexported fields
}

func (*HomePageParser) GetAllGenres

func (p *HomePageParser) GetAllGenres()

func (*HomePageParser) GetMostFavoriteAnime

func (p *HomePageParser) GetMostFavoriteAnime()

func (*HomePageParser) GetRecentlyAddedAnime

func (p *HomePageParser) GetRecentlyAddedAnime()

func (*HomePageParser) GetRecentlyUpdatedAnime

func (p *HomePageParser) GetRecentlyUpdatedAnime()

func (*HomePageParser) GetSpotlightAnime

func (p *HomePageParser) GetSpotlightAnime()

func (*HomePageParser) GetTopAiringAnime

func (p *HomePageParser) GetTopAiringAnime()

func (*HomePageParser) GetTopViewedAnime

func (p *HomePageParser) GetTopViewedAnime()

func (*HomePageParser) GetTrendingAnime

func (p *HomePageParser) GetTrendingAnime()

func (*HomePageParser) GetUpcomingAnime

func (p *HomePageParser) GetUpcomingAnime()

type HomePageResources

type HomePageResources interface {
	TopAiringAnime | MostFavoriteAnime | SpotlightAnime
}

type MostFavoriteAnime

type MostFavoriteAnime struct {
	Status bool                `json:"status"`
	Result []CommonAnimeResult `json:"result"`
}

type RecentlyAddedAnime

type RecentlyAddedAnime struct {
	Status `json:"status"`
	Result []CommonAnimeResult `json:"result"`
}

type RecentlyUpdatedAnime

type RecentlyUpdatedAnime struct {
	Status `json:"status"`
	Result []CommonAnimeResult `json:"result"`
}

type ScrapedHomePage

type ScrapedHomePage struct {
	Status                `json:"status"`
	MostFavoriteAnimes    []CommonAnimeResult  `json:"mostFavoriteAnimes"`
	TopAiringAnimes       []CommonAnimeResult  `json:"topAiringAnimes"`
	SpotlightAnimes       []CommonAnimeResult  `json:"spotlightAnimes"`
	RecentlyUpdatedAnimes []CommonAnimeResult  `json:"recentlyUpdatedAnimes"`
	TrendingAnimes        []CommonAnimeResult  `json:"trendingAnimes"`
	RecentlyAddedAnimes   []CommonAnimeResult  `json:"recentlyAddedAnimes"`
	TopViewedAnime        TopViewedAnimeResult `json:"topViewedAnime"`
	UpcomingAnimes        []CommonAnimeResult  `json:"upcomingAnimes"`
	Genres                []Genre              `json:"genres"`
}

type SpotlightAnime

type SpotlightAnime struct {
	Status `json:"status"`
	Result []CommonAnimeResult `json:"result"`
}

type Status

type Status bool

type TopAiringAnime

type TopAiringAnime struct {
	Status bool                `json:"status"`
	Result []CommonAnimeResult `json:"result"`
}

type TopViewedAnime

type TopViewedAnime struct {
	Status `json:"status"`
	Result TopViewedAnimeResult `json:"result"`
}

type TopViewedAnimeResult

type TopViewedAnimeResult struct {
	TopViewedDay   []CommonAnimeResult `json:"topViewedDay"`
	TopViewedWeek  []CommonAnimeResult `json:"topViewedWeek"`
	TopViewedMonth []CommonAnimeResult `json:"topViewedMonth"`
}

type TrendingAnime

type TrendingAnime struct {
	Status `json:"status"`
	Result []CommonAnimeResult `json:"result"`
}

type UpcomingAnime

type UpcomingAnime struct {
	Status `json:"status"`
	Result []CommonAnimeResult `json:"result"`
}

Jump to

Keyboard shortcuts

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