mirror of
https://git.mirrors.martin98.com/https://github.com/mendableai/firecrawl
synced 2025-08-08 19:29:02 +08:00
Merge pull request #1038 from 1101-1/add_actual_random_useragent
feat: use new random user agent instead of the old one
This commit is contained in:
commit
b82cfa8540
@ -2,7 +2,7 @@ import express, { Request, Response } from 'express';
|
|||||||
import bodyParser from 'body-parser';
|
import bodyParser from 'body-parser';
|
||||||
import { chromium, Browser, BrowserContext, Route, Request as PlaywrightRequest } from 'playwright';
|
import { chromium, Browser, BrowserContext, Route, Request as PlaywrightRequest } from 'playwright';
|
||||||
import dotenv from 'dotenv';
|
import dotenv from 'dotenv';
|
||||||
import randomUseragent from 'random-useragent';
|
import UserAgent from 'user-agents';
|
||||||
import { getError } from './helpers/get_error';
|
import { getError } from './helpers/get_error';
|
||||||
|
|
||||||
dotenv.config();
|
dotenv.config();
|
||||||
@ -60,7 +60,7 @@ const initializeBrowser = async () => {
|
|||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
const userAgent = randomUseragent.getRandom();
|
const userAgent = new UserAgent().toString();
|
||||||
const viewport = { width: 1280, height: 800 };
|
const viewport = { width: 1280, height: 800 };
|
||||||
|
|
||||||
const contextOptions: any = {
|
const contextOptions: any = {
|
||||||
|
@ -16,12 +16,12 @@
|
|||||||
"dotenv": "^16.4.5",
|
"dotenv": "^16.4.5",
|
||||||
"express": "^4.19.2",
|
"express": "^4.19.2",
|
||||||
"playwright": "^1.45.0",
|
"playwright": "^1.45.0",
|
||||||
"random-useragent": "^0.5.0"
|
"user-agents": "^1.1.410"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/express": "^4.17.21",
|
"@types/express": "^4.17.21",
|
||||||
"@types/node": "^20.14.9",
|
"@types/node": "^20.14.9",
|
||||||
"@types/random-useragent": "^0.3.3",
|
"@types/user-agents": "^1.0.4",
|
||||||
"ts-node": "^10.9.2",
|
"ts-node": "^10.9.2",
|
||||||
"typescript": "^5.5.2"
|
"typescript": "^5.5.2"
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user