mirror of
https://github.com/knightcrawler-stremio/knightcrawler.git
synced 2024-12-20 03:29:51 +00:00
[scraper] adds response and read timeouts fro eztv
This commit is contained in:
@@ -7,7 +7,7 @@ const { getRandomUserAgent } = require('./../../lib/request_helper');
|
|||||||
const defaultProxies = [
|
const defaultProxies = [
|
||||||
'https://eztv.io'
|
'https://eztv.io'
|
||||||
];
|
];
|
||||||
const defaultTimeout = 30000;
|
const defaultTimeout = 20000;
|
||||||
const minDelay = 3000;
|
const minDelay = 3000;
|
||||||
const jitterDelay = minDelay;
|
const jitterDelay = minDelay;
|
||||||
const limit = 100;
|
const limit = 100;
|
||||||
@@ -53,7 +53,13 @@ function browse(config = {}, retries = 1) {
|
|||||||
|
|
||||||
function singleRequest(requestUrl, config = {}) {
|
function singleRequest(requestUrl, config = {}) {
|
||||||
const timeout = config.timeout || defaultTimeout;
|
const timeout = config.timeout || defaultTimeout;
|
||||||
const options = { userAgent: getRandomUserAgent(), open_timeout: timeout, follow: 2 };
|
const options = {
|
||||||
|
userAgent: getRandomUserAgent(),
|
||||||
|
open_timeout: timeout,
|
||||||
|
response_timeout: timeout,
|
||||||
|
read_timeout: timeout,
|
||||||
|
follow: 2
|
||||||
|
};
|
||||||
|
|
||||||
return needle('get', requestUrl, options)
|
return needle('get', requestUrl, options)
|
||||||
.then(response => {
|
.then(response => {
|
||||||
|
|||||||
Reference in New Issue
Block a user