May 27th, 2020
Create Web Crawlers That Dont Die on You

Here are some rules of thumb to follow when building web crawlers that can scale.

  1. De-couple the web crawling and the web scraping process. This is because you can then measure and speed up the performance of each of these processes separately.
  1. Do not use Regex for scraping. Use XPath or CSS selectors instead. Regex will be the first to break when the target web page's HTML changes even a little bit.
  1. Assume every external dependant process or method will fail and write handlers and loggers for each. For example, assume the URL fetch will fail, timeout, redirect, return empty, or show a CAPTCHA. Anticipate and log each of these exceptions.
  1. Make it easy to debug your app by tracing all the steps your crawler goes through. Make the logger as rich as possible. Send yourself alerts so you immediately know if there is something wrong.
  1. Learn how to get your crawlers to pretend to be human.
  1. Build a crawler around a framework. Custom code will have a bunch more points of failure.
Share this article:

Get our articles in your inbox

Dont miss our best tips/tricks/tutorials about Web Scraping
Only great content, we don’t share your email with third parties.
Icon