Skip to content

Commit

Permalink
Minor
Browse files Browse the repository at this point in the history
  • Loading branch information
msveshnikov committed Mar 25, 2024
1 parent fdca0e6 commit b70466d
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions server/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ const userAgents = [

export async function fetchSearchResults(query) {
console.log(query);
const browser = await puppeteer.launch();
const browser = await puppeteer.launch({
headless: true,
args: ['--no-sandbox']
});
const page = await browser.newPage();
// const randomUserAgent = userAgents[Math.floor(Math.random() * userAgents.length)];
// await page.setUserAgent(randomUserAgent);
Expand All @@ -37,7 +40,10 @@ export async function fetchSearchResults(query) {
}

export async function fetchPageContent(url) {
const browser = await puppeteer.launch();
const browser = await puppeteer.launch({
headless: true,
args: ['--no-sandbox']
});
const page = await browser.newPage();
const randomUserAgent = userAgents[Math.floor(Math.random() * userAgents.length)];
await page.setUserAgent(randomUserAgent);
Expand Down

0 comments on commit b70466d

Please sign in to comment.