Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/resto review randuser agent #23

Merged
merged 2 commits into from
Apr 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app.js
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ setInterval(async () => {
// Log the tab stats
console.log(report);
// Exit if no tab is in use and browser is being loaded
// if (inUse === 0 && typeof (openedPage) !== 'string') process.exit(0);
if (inUse === 0 && typeof (openedPage) !== 'string') process.exit(0);
}


Expand Down
9 changes: 0 additions & 9 deletions scrapers/resto.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,8 @@ const customChalk = new Chalk({ level: colorLevel });
const extractAllReviewPageUrls = async (restoUrl, position, language, browser) => {
try {

// Generate a random user agent
const agent = randUserAgent("desktop");

// Open a new page
const page = await browser.getNewPage()
await page.setUserAgent(agent);

// Navigate to the resto page
await page.goto(restoUrl);
Expand Down Expand Up @@ -205,13 +201,8 @@ const extractAllReviewPageUrls = async (restoUrl, position, language, browser) =
const scrape = async (totalReviewCount, reviewPageUrls, position, restoName, restoId, language, browser) => {
try {

// Generate a random user agent
const agent = randUserAgent("desktop");


// Open a new page
const page = await browser.getNewPage()
await page.setUserAgent(agent);

// Array to hold all the reviews
const allReviews = [];
Expand Down