gem "scrapeunblocker". Requires Ruby 2.7+.
Store your API key in an environment variable so the client picks it up automatically:
Quickstart
Get parsed JSON instead of HTML
Scrape a Google SERP
Force a country
Capture cookies and the proxy used
Fetch an image
Skyscanner plugins
Error handling
Non-2xx responses raise typed errors, all subclasses ofScrapeUnblocker::Error. Transient failures (429, 502, 503, 504 and network errors) are retried automatically; a 401 or 402 is never retried, because it clears when the key or the billing state changes.
The
402 and 404-422 errors were added in 0.1.6; before that they arrived as a bare APIError. Nothing was removed, so rescue ScrapeUnblocker::APIError written against earlier versions keeps working. See all status codes in Errors.Raw HTTP (without the gem)
The API is plain HTTP, so Ruby’s standard library is enough - no gem required.getPageSource, serpApi, and getImage; every parameter shown above maps to a query parameter of the same name.
