mirror of
https://github.com/sussy-code/smov.git
synced 2024-12-20 14:37:43 +01:00
Fix inconsistent TMDB season naming
This commit is contained in:
parent
8e7b2d38ea
commit
b2c4b54893
1 changed files with 11 additions and 1 deletions
|
@ -56,7 +56,17 @@ async function findContent(searchTerm, type) {
|
|||
}
|
||||
|
||||
async function getEpisodes(slug) {
|
||||
const tmdbRes = await fetch(`${process.env.REACT_APP_CORS_PROXY_URL}https://www.themoviedb.org/tv/${slug}/seasons`).then(d => d.text());
|
||||
let tmdbRes;
|
||||
|
||||
try {
|
||||
tmdbRes = await fetch(`${process.env.REACT_APP_CORS_PROXY_URL}https://www.themoviedb.org/tv/${slug}/seasons`).then(d => d.text());
|
||||
} catch (err) {
|
||||
tmdbRes = await fetch(`${process.env.REACT_APP_CORS_PROXY_URL}https://www.themoviedb.org/tv/${slug.split('-')[0]}/seasons`).then(d => d.text());
|
||||
|
||||
if (tmdbRes)
|
||||
slug = slug.split('-')[0];
|
||||
}
|
||||
|
||||
const sNodes = Array.from(new DOMParser().parseFromString(tmdbRes, 'text/html').querySelectorAll('div.column_wrapper > div.flex > div'));
|
||||
|
||||
let seasons = [];
|
||||
|
|
Loading…
Reference in a new issue