Add user agent (#19)
Add user agent to try circumventing DDoS protection.
This commit is contained in:
+4
-1
@@ -1,9 +1,12 @@
|
||||
const chromium = require("chrome-aws-lambda");
|
||||
const puppeteer = require("puppeteer");
|
||||
const UserAgent = require("user-agents");
|
||||
|
||||
const userAgent = new UserAgent();
|
||||
|
||||
const scraper = async (url) => {
|
||||
const browser = await puppeteer.launch({
|
||||
args: [...chromium.args, "--hide-scrollbars", "--disable-web-security"],
|
||||
args: [...chromium.args, "--hide-scrollbars", "--disable-web-security", "--user-agent=" + userAgent + ""],
|
||||
defaultViewport: chromium.defaultViewport,
|
||||
executablePath: await chromium.executablePath,
|
||||
headless: true,
|
||||
|
||||
Reference in New Issue
Block a user