add media download service and started using it
This commit is contained in:
1 parent
78399912f7
commit
06be888123
12 files changed
+614
-80
No files matched your search
@@ -39,9 +39,28 @@ async function fetchSeasonData(tmdbTvId, seasonNumber) {
|
||||
}
|
||||
}
|
||||
|
||||
async function fetchEntryMedia(tmdb_id, is_tvserie) {
|
||||
try {
|
||||
let type = is_tvserie ? "tv" : "movie";
|
||||
let url = `http://api.themoviedb.org/3/${type}/${tmdb_id}/images?api_key=${tmdb_apiKey}`
|
||||
let data;
|
||||
await axios.get(url)
|
||||
.then((response) => {
|
||||
if (response.status != 200) return console.log('Error fetching entry media.');
|
||||
data = response.data;
|
||||
})
|
||||
|
||||
return data;
|
||||
} catch (error) {
|
||||
console.log('Error fetching the entry media.', error)
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
fetchEntryData,
|
||||
fetchSeasonData,
|
||||
fetchEntryMedia,
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user