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:
Nicolas 2025-01-06 11:51:15 -03:00 committed by GitHub
commit b82cfa8540
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 4 deletions

View File

@ -2,7 +2,7 @@ import express, { Request, Response } from 'express';
import bodyParser from 'body-parser';
import { chromium, Browser, BrowserContext, Route, Request as PlaywrightRequest } from 'playwright';
import dotenv from 'dotenv';
import randomUseragent from 'random-useragent';
import UserAgent from 'user-agents';
import { getError } from './helpers/get_error';
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 contextOptions: any = {

View File

@ -16,12 +16,12 @@
"dotenv": "^16.4.5",
"express": "^4.19.2",
"playwright": "^1.45.0",
"random-useragent": "^0.5.0"
"user-agents": "^1.1.410"
},
"devDependencies": {
"@types/express": "^4.17.21",
"@types/node": "^20.14.9",
"@types/random-useragent": "^0.3.3",
"@types/user-agents": "^1.0.4",
"ts-node": "^10.9.2",
"typescript": "^5.5.2"
}