constant

package
Version: v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2020 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MyAnimeListURL is MyAnimeList web base URL.
	MyAnimeListURL = "https://myanimelist.net"
	// CDNMyAnimeListURL is CDN of MyAnimeList web base URL.
	CDNMyAnimeListURL = "https://cdn.myanimelist.net"
)
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
	// Err2002 is code for error while reading JSON response from MyAnimeList
	Err2002 = 2002
	// Err2003 is code for error while parsing JSON response from MyAnimeList
	Err2003 = 2003
	// 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
	RedisGetAnimeFeatured       = "mal:anime-featured"       // GetAnimeFeatured(1) -> mal:anime-featured:1
	RedisGetAnimeClub           = "mal:anime-club"           // GetAnimeClub(1) -> mal:anime-club: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
	RedisGetMangaFeatured       = "mal:manga-featured"       // GetMangaFeatured(1) -> mal:manga-featured:1
	RedisGetMangaClub           = "mal:manga-club"           // GetMangaClub(1) -> mal:manga-club: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
	RedisGetCharacterFeatured   = "mal:character-featured"   // GetCharacterFeatured(1) -> mal:character-featured:1
	RedisGetCharacterClub       = "mal:character-club"       // GetCharacterClub(1) -> mal:character-club: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
	RedisGetPeopleFeatured      = "mal:people-featured"      // GetPeopleFeatured(1) -> mal:people-Featured: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
	RedisGetUserClub            = "mal:user-club"            // GetUserClub(rl404) -> mal:user-club:rl404
	RedisGetUserAnime           = "mal:user-anime"           // GetUserAnime(rl404, 7, 2) -> mal:user-anime:rl404,7,2
	RedisGetUserManga           = "mal:user-manga"           // GetUserManga(rl404, 7, 2) -> mal:user-manga:rl404,7,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
	RedisSearchClub             = "mal:search-club"          // SearchClub(query, 1, 2, 3) -> mal:search-club:query,1,2,3
	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
	RedisGetNewsTag             = "mal:news-tag"             // GetNewsTag() -> mal:news-tag
	RedisGetFeatured            = "mal:featured"             // GetFeatured(2321) -> mal:featured:2321
	RedisGetFeaturedTag         = "mal:featured-tag"         // GetFeaturedTag() -> mal:featured-tag
	RedisGetFeaturedList        = "mal:featured-list"        // GetFeaturedList(games, 2) -> mal:featured-list:games,2
	RedisGetClubs               = "mal:clubs"                // Getclubs(1, 2) -> mal:clubs:1,2
	RedisGetClub                = "mal:club"                 // Getclub(1) -> mal:club:1
	RedisGetClubMember          = "mal:club-member"          // GetclubMember(1, 2) -> mal:club-member:1,2
	RedisGetClubPicture         = "mal:club-picture"         // GetclubPicture(1) -> mal:club-picture:1
)

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", "ona", "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"}

	// ClubCategories is type list of clubs.
	ClubCategories = map[int]string{
		0:  "All",
		1:  "Anime",
		2:  "Conventions",
		3:  "Actors & Artists",
		4:  "Characters",
		5:  "Companies",
		6:  "Games",
		7:  "Japan",
		8:  "Cities & Neighborhoods",
		9:  "Music",
		10: "Manga",
		11: "Schools",
		12: "Other",
	}
)
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")
	// ErrInvalidYear will throw if year is negative.
	ErrInvalidYear = errors.New("invalid year")
	// 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")
	// ErrInvalidSortType will throw if sort type is invalid.
	ErrInvalidSortType = errors.New("invalid sort type")
	// ErrInvalidClubCategory will throw if club catergory is invalid.
	ErrInvalidClubCategory = errors.New("invalid club category")
	// ErrInvalidListStatus will throw if anime/manga list status is invalid.
	ErrInvalidListStatus = errors.New("invalid list status")
	// ErrInvalidUsername will throw if username is invalid.
	ErrInvalidUsername = errors.New("invalid username")
	// ErrNewData will throw if re-parse requested entry is still new.
	ErrNewData = errors.New("data is still new")
)

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