mirror of
https://github.com/knightcrawler-stremio/knightcrawler.git
synced 2024-12-20 03:29:51 +00:00
[scraper] handles non json tpb request results
This commit is contained in:
@@ -102,7 +102,12 @@ function browse(config = {}, retries = 2) {
|
||||
async function _request(endpoint) {
|
||||
const url = `${baseUrl}/${endpoint}`;
|
||||
return needle('get', url, { open_timeout: timeout })
|
||||
.then(response => response.body);
|
||||
.then(response => {
|
||||
if (typeof response.body === 'object') {
|
||||
return response.body;
|
||||
}
|
||||
return Promise.reject(`Unexpected response body`);
|
||||
});
|
||||
}
|
||||
|
||||
function toTorrent(result) {
|
||||
|
||||
Reference in New Issue
Block a user