constant

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2020 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MyAnimeListURL is MyAnimeList web base URL.
	MyAnimeListURL = "https://myanimelist.net"
	// SuccessCode is response code for success response.
	SuccessCode = 200
	// SuccessMessage is a message for success response message.
	SuccessMessage = "success"
	// BadRequestCode is response code when the request param is invalid.
	BadRequestCode = 400
	// BadRequestMessage is a message for bad request response message.
	BadRequestMessage = "bad request"
	// InternalErrorCode is response code if there is something wrong when processing the request.
	InternalErrorCode = 500
	// InternalErrorMessage is a message for internal server error response message.
	InternalErrorMessage = "internal error"
)
View Source
const (
	// Err1001 is code for error while retrieving value from redis.
	Err1001 = 1001
	// Err2001 is code for error while getting HTML file from MyAnimeList.
	Err2001 = 2001
	// Err3001 is code for error while goquery failed parsing HTML from MyAnimeList.
	Err3001 = 3001
)
View Source
const (
	LibName        = "malscraper"
	RedisFound     = "redis key found"
	RedisSave      = "save to redis"
	SuccessParsing = "success parsing"
	SettingDetails = "setting details"
)

List of common string message for logging.

View Source
const (
	RedisGetAnime               = "mal:anime"                // GetAnime(1) -> mal:anime:1
	RedisGetAnimeVideo          = "mal:anime-video"          // GetAnimeVideo(1, 2) -> mal:anime-video:1,2
	RedisGetAnimeEpisode        = "mal:anime-episode"        // GetAnimeEpisode(1, 2) -> mal:anime-episode:1,2
	RedisGetAnimeReview         = "mal:anime-review"         // GetAnimeReview(1, 2) -> mal:anime-review:1,2
	RedisGetAnimeRecommendation = "mal:anime-recommendation" // GetAnimeRecommendation(1) -> mal:anime-recommendation:1
	RedisGetAnimeStats          = "mal:anime-stats"          // GetAnimeStats(1, 2) -> mal:anime-stats:1,2
	RedisGetAnimeCharacter      = "mal:anime-character"      // GetAnimeCharacter(1) -> mal:anime-character:1
	RedisGetAnimeStaff          = "mal:anime-staff"          // GetAnimeStaff(1) -> mal:anime-staff:1
	RedisGetAnimeNews           = "mal:anime-news"           // GetAnimeNews(1) -> mal:anime-news:1
	RedisGetAnimePicture        = "mal:anime-picture"        // GetAnimePicture(1) -> mal:anime-picture:1
	RedisGetAnimeMoreInfo       = "mal:anime-more-info"      // GetAnimeMoreInfo(1) -> mal:anime-more-info:1
	RedisGetManga               = "mal:manga"                // GetManga(1) -> mal:manga:1
	RedisGetMangaReview         = "mal:manga-review"         // GetMangaReview(1, 2) -> mal:manga-review:1,2
	RedisGetMangaRecommendation = "mal:manga-recommendation" // GetMangaRecommendation(1) -> mal:manga-recommendation:1
	RedisGetMangaStats          = "mal:manga-stats"          // GetMangaStats(1, 2) -> mal:manga-stats:1,2
	RedisGetMangaCharacter      = "mal:manga-character"      // GetMangaCharacter(1) -> mal:manga-character:1
	RedisGetMangaNews           = "mal:manga-news"           // GetMangaNews(1) -> mal:manga-news:1
	RedisGetMangaPicture        = "mal:manga-picture"        // GetMangaPicture(1) -> mal:manga-picture:1
	RedisGetMangaMoreInfo       = "mal:manga-more-info"      // GetMangaMoreInfo(1) -> mal:manga-more-info:1
	RedisGetCharacter           = "mal:character"            // GetCharacter(1) -> mal:character:1
	RedisGetCharacterPicture    = "mal:character-picture"    // GetCharacterPicture(1) -> mal:character-picture:1
	RedisGetPeople              = "mal:people"               // GetPeople(1) -> mal:people:1
	RedisGetPeopleNews          = "mal:people-news"          // GetPeopleNews(1) -> mal:people-news:1
	RedisGetPeoplePicture       = "mal:people-picture"       // GetPeoplePicture(1) -> mal:people-picture:1
	RedisGetProducers           = "mal:producers"            // GetProducers() -> mal:producers
	RedisGetProducer            = "mal:producer"             // GetProducer(1, 2) -> mal:producer:1,2
	RedisGetMagazines           = "mal:magazines"            // GetMagazines() -> mal:magazines
	RedisGetMagazine            = "mal:magazine"             // GetMagazine(1, 2) -> mal:magazine:1,2
	RedisGetGenres              = "mal:genres"               // GetGenres(anime) -> mal:genres:anime
	RedisGetAnimeWithGenre      = "mal:anime-with-genre"     // GetAnimeWithGenre(1, 2) -> mal:anime-with-genre:1,2
	RedisGetMangaWithGenre      = "mal:manga-with-genre"     // GetMangaWithGenre(1, 2) -> mal:manga-with-genre:1,2
	RedisGetReviews             = "mal:reviews"              // GetReviews(anime, 2) -> mal:reviews:anime,2
	RedisGetReview              = "mal:review"               // GetReview(1) -> mal:review:1
	RedisGetRecommendations     = "mal:recommendations"      // GetRecommendations(anime, 2) -> mal:recommendations:anime,2
	RedisGetRecommendation      = "mal:recommendation"       // GetRecommendation(anime, 1, 2) -> mal:recommendation:anime,1,2
	RedisGetUser                = "mal:user"                 // GetUser(rl404) -> mal:user:rl404
	RedisGetUserFriend          = "mal:user-friend"          // GetUserFriend(rl404, 2) -> mal:user-friend:rl404,2
	RedisGetUserHistory         = "mal:user-history"         // GetUserHistory(rl404, anime) -> mal:user-history:rl404,anime
	RedisGetUserReview          = "mal:user-review"          // GetUserReview(rl404, 2) -> mal:user-review:rl404,2
	RedisGetUserRecommendation  = "mal:user-recommendation"  // GetUserRecommendation(rl404, 2) -> mal:user-recommendation:rl404,2
	RedisSearchCharacter        = "mal:search-character"     // SearchCharacter(query, 2) -> mal:search-character:query,2
	RedisSearchPeople           = "mal:search-people"        // SearchPeople(query, 2) -> mal:search-people:query,2
	RedisSearchUser             = "mal:search-user"          // SearchUser(query, 2) -> mal:search-user:query,2
	RedisGetSeason              = "mal:season"               // GetSeason(2019, winter) -> mal:season:2019,winter
	RedisGetTopAnime            = "mal:top-anime"            // GetTopAnime(1, 2) -> mal:top-anime:1,2
	RedisGetTopManga            = "mal:top-manga"            // GetTopManga(1, 2) -> mal:top-manga:1,2
	RedisGetTopCharacter        = "mal:top-character"        // GetTopCharacter(1) -> mal:top-character:1
	RedisGetTopPeople           = "mal:top-people"           // GetTopPeople(1) -> mal:top-people:1
	RedisGetNewsList            = "mal:news-list"            // GetNewsList(new_anime, 1) -> mal:news-list:news_anime,1
	RedisGetNews                = "mal:news"                 // GetNews(34036779) -> mal:news:34036779
)

List of redis key used in malscraper.

Variables

View Source
var (
	// MainType is a valid general types.
	MainType = []string{"anime", "manga"}

	// AnimeSeasons is anime season list.
	AnimeSeasons = []string{"winter", "spring", "summer", "fall"}

	// TopAnimeTypes is type list of top anime list.
	TopAnimeTypes = []string{"", "airing", "upcoming", "tv", "movie", "ova", "special", "bypopularity", "favorite"}

	// TopMangaTypes is type list of top manga list.
	TopMangaTypes = []string{"", "manga", "novels", "oneshots", "doujin", "manhwa", "manhua", "bypopularity", "favorite"}

	// ReviewTypes is type list of review list.
	ReviewTypes = []string{"anime", "manga", "bestvoted"}
)
View Source
var (
	// Err3LettersSearch will throw if search query string is less than 3 letters.
	Err3LettersSearch = errors.New("search query needs at least 3 letters")
	// ErrInvalidMainType will throw if not a valid type.
	ErrInvalidMainType = errors.New("invalid type")
	// ErrInvalidSeason will throw if value is not a valid season name.
	ErrInvalidSeason = errors.New("invalid season name")
	// ErrMissingRedis will throw if redis client is nil.
	ErrMissingRedis = errors.New("missing redis client")
	// ErrInvalidID will throw if id is invalid (must positive and not zero).
	ErrInvalidID = errors.New("invalid ID")
	// ErrInvalidPage will throw if page number is invalid (must positive and not zero).
	ErrInvalidPage = errors.New("invalid page")
)

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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