[scraper] adds proxy for kat and 1337x

This commit is contained in:
TheBeastLT
2020-05-02 17:35:50 +02:00
parent cd5fac2f60
commit 2bb0570194
5 changed files with 22 additions and 29 deletions

View File

@@ -16,4 +16,17 @@ function getRandomProxy() {
return undefined;
}
module.exports = { getRandomUserAgent, getRandomProxy };
function defaultOptionsWithProxy() {
if (process.env.PROXY_HOST && process.env.PROXY_TYPE) {
return {
proxy: process.env.PROXY_HOST,
headers: {
'user-agent': getRandomUserAgent(),
'proxy-type': process.env.PROXY_TYPE
}
}
}
return { userAgent: getRandomUserAgent() };
}
module.exports = { getRandomUserAgent, getRandomProxy, defaultOptionsWithProxy };