mirror of
https://github.com/movie-web/movie-web.git
synced 2024-11-13 07:55:06 +01:00
Fix inconsistent TMDB season naming
This commit is contained in:
parent
8e7b2d38ea
commit
b2c4b54893
@ -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 New Issue
Block a user