In my early web days, I was interested in scraping and collecting data based on the results of Google searches. Scraping Google was easier in those days but now Google search results are so dynamic that you can’t rely on getting the same HTML or data structure back. Add in CAPTCHAs, rate limits, etc, and the task gets even more difficult.

If you need reliable results, you’re best using an awesome service like serpstack: an API that can parse Google results and provide you the data in a logical, reliable format!

Quick Hits

  • Provides results for standard search, maps, shopping, images, weather, and more
  • Provides ad information per search, to allow you to see who’s competing with you for what keywords
  • Choose your request location to get localized results
  • Brought to you by apilayer, creators of currencylayer, mailboxlayer, userstack, etc.
  • Free to start!

After signing up for your account, you can make requests to serpstack’s API endpoints to get the desired data — a few key parameters include:

  • query – the search term to execute
  • type – target different types of search: web, images, videos, news, or shopping
  • device – mobile, desktop, or tablet

There are dozens of other options depending on the search type you’re executing, like:

  • image_size: icon, medium, or large
  • images_type: clipart, line_drawing, or gif
  • news_type: blogs, etc.

The response for searches will also be variable, depending on the type of search and the options you send your request with; here’s a breakdown of the serpstack response categories based on position in page:

So let’s make a few sample requests using the serpstack API:

# Get web results from tablet device

# Get the second page of shopping results from Canada

serpstack is a really awesome and amazingly detailed API. Google search results have become so variable that writing your own scraper/parser is an overwhelming task. But the power of tracking your own results and your competitor’s results? Priceless!

Source link