-
Notifications
You must be signed in to change notification settings - Fork 0
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
[Chore] Improve structure of GoogleSearcher #11
Comments
inside page.evaluate() function runs in the browser context, not in the node.js context. So it does not work when I separate the calculation of different properties in private functions. is it acceptable to define functions for calculating intended variables? |
That is indeed the challenge to solve 💦 The solution is to work off a string of the scraped page instead of a process. For that, the most standard solution is to 1) fetch the HTML content of the Google search page (this can be done with |
At first. I considered both axios, cheerio combination and puppeteer for scraping. Eventually, decided to use puppeteer for its convenience to use as it imitates a regular browser and supports javascript dom. |
the last commit on the #15 pr implements searcher based on axios and cheerio |
Issue
The code business logic for the scraper is contained in one method of 30 lines with many inline variables (e.g., DOM selectors for the ads, Google URL).
Expected
Use OOP best practices to structure
GoogleSearcher
:The text was updated successfully, but these errors were encountered: