mirror of
https://github.com/knightcrawler-stremio/knightcrawler.git
synced 2024-12-20 03:29:51 +00:00
fix google sr
This commit is contained in:
@@ -8,6 +8,10 @@ const { Type } = require('./types');
|
|||||||
const CINEMETA_URL = 'https://v3-cinemeta.strem.io';
|
const CINEMETA_URL = 'https://v3-cinemeta.strem.io';
|
||||||
const KITSU_URL = 'https://anime-kitsu.strem.fun';
|
const KITSU_URL = 'https://anime-kitsu.strem.fun';
|
||||||
const TIMEOUT = 20000;
|
const TIMEOUT = 20000;
|
||||||
|
const selectors = {
|
||||||
|
...googleSr.defaultSelectors,
|
||||||
|
LinkSelector: 'a:has(h3)'
|
||||||
|
}
|
||||||
|
|
||||||
function getMetadata(id, type = Type.SERIES) {
|
function getMetadata(id, type = Type.SERIES) {
|
||||||
if (!id) {
|
if (!id) {
|
||||||
@@ -108,7 +112,7 @@ async function getImdbId(info, type) {
|
|||||||
reject(err || new Error('failed imdbId search'));
|
reject(err || new Error('failed imdbId search'));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}).catch(() => googleSr.search(query)
|
}).catch(() => googleSr.search(query, { selectors })
|
||||||
.then(response => response.length ? response : Promise.reject('No results'))
|
.then(response => response.length ? response : Promise.reject('No results'))
|
||||||
.then(results => results
|
.then(results => results
|
||||||
.map(result => result.Link)
|
.map(result => result.Link)
|
||||||
|
|||||||
Reference in New Issue
Block a user