mirror of
https://github.com/knightcrawler-stremio/knightcrawler.git
synced 2024-12-20 03:29:51 +00:00
updates metadata retrieval exception handling
This commit is contained in:
@@ -9,6 +9,10 @@ const KITSU_URL = 'https://anime-kitsu.now.sh';
|
||||
const TIMEOUT = 20000;
|
||||
|
||||
function getMetadata(id, type = Type.SERIES) {
|
||||
if (!id) {
|
||||
return Promise.reject("no valid id provided");
|
||||
}
|
||||
|
||||
const key = id.match(/^\d+$/) ? `kitsu:${id}` : id;
|
||||
const metaType = type === Type.MOVIE ? Type.MOVIE : Type.SERIES;
|
||||
return cacheWrapMetadata(key,
|
||||
@@ -86,10 +90,11 @@ async function getImdbId(info) {
|
||||
}
|
||||
});
|
||||
}).catch(() => bing.web(`${info.name} ${info.year || ''} ${info.type} imdb`)
|
||||
.then((results) => results
|
||||
.then(results => results
|
||||
.map((result) => result.link)
|
||||
.find(result => result.includes('imdb.com/title/'))
|
||||
.match(/imdb\.com\/title\/(tt\d+)/)[1])));
|
||||
.find(result => result.includes('imdb.com/title/')))
|
||||
.then(result => result && result.match(/imdb\.com\/title\/(tt\d+)/))
|
||||
.then(match => match && match[1])));
|
||||
}
|
||||
|
||||
async function getKitsuId(info) {
|
||||
|
||||
2
package-lock.json
generated
2
package-lock.json
generated
@@ -1714,7 +1714,7 @@
|
||||
}
|
||||
},
|
||||
"parse-torrent-title": {
|
||||
"version": "git://github.com/TheBeastLT/parse-torrent-title.git#91d711a5c3558baced7d20cb5a5458a859ddede6",
|
||||
"version": "git://github.com/TheBeastLT/parse-torrent-title.git#d6b677ad5e576c9294de1de75c0fd1396bd1ab7b",
|
||||
"from": "git://github.com/TheBeastLT/parse-torrent-title.git#master"
|
||||
},
|
||||
"parseurl": {
|
||||
|
||||
@@ -63,7 +63,6 @@ async function scrape() {
|
||||
console.log(err);
|
||||
});
|
||||
lr.on('end', () => {
|
||||
fs.unlink(CSV_FILE_PATH);
|
||||
console.log(`finished to scrape tpb dump!`);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user