fix: fetching wrong anime season

idk why an array is returned for some seasons resulting in '3,03' so instead of it failing and returning the default season we can now return the first entry in the array.
This commit is contained in:
RockinChaos 2024-05-31 18:24:47 -07:00
parent 7b3ed60b86
commit ced891ef29

View file

@ -175,6 +175,8 @@ export async function anitomyscript (...args) {
obj.anime_season = seasonMatch[1]
obj.episode_number = seasonMatch[2]
obj.anime_title = obj.anime_title.replace(/S(\d{2})E(\d{2})/, '')
} else if (Array.isArray(obj.anime_season)) {
obj.anime_season = obj.anime_season[0]
}
const yearMatch = obj.anime_title.match(/ (19[5-9]\d|20\d{2})/)
if (yearMatch && Number(yearMatch[1]) <= (new Date().getUTCFullYear() + 1)) {