junnd23 / scraping-keyword-web

Web-application allows users to scrape keyword information
0 stars 0 forks source link

Insufficient solution to handle core business logic #6

Open longnd opened 9 months ago

longnd commented 9 months ago

Issue

There are some limitation in the architecture for the core business logic (scrapping process)

it has some drawbacks

-> another better solution could be

Also, the decision to use Chromedp to manupulate the search isn't effective as launching the chrome browser is slow & resource-intensive. -> A simpler solution could be using a HTTP client to send the search request directly, and then parsing the response. A simple CURL command could demonstrate the idea

curl -A "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3" https://www.google.com/search\?q\=nodejs
junnd23 commented 9 months ago

Thank you for your feedback, but I want to clarify about these issues:

  1. I use goroutine for handling crawling keyword data, so it will be asynchronous, ensuring crawling each keyword independently and not being blocked. But I see your recommendation for responding statuses of keywords is needed to do.
  2. I tried to use a HTTP client but the parsed response didn't contain informations like "total of results", e.g. These contents are just showed after the JS running, so I decided to use Chromedq.

Once again, thank you for your feedback, and I value your perspective. I always open to further discussion to ensure the best possible outcome, it's my pleasure to receive your feedback.