Scraping Google in Ruby usually means open-uri + Nokogiri, then a proxy list, then a headless browser. Here’s the cheap alternative: one HTTP call that returns Google results as structured JSON — no Nokogiri, no proxies.
Why DIY scraping in Ruby gets expensive
- IP blocks — Google blocks datacenter IPs within minutes; you’d rent rotating residential proxies.
- CAPTCHAs — volume triggers them, and solving costs add up.
- Headless browsers — JS-rendered results push you to Ferrum/Selenium, slow and heavy.
- Nokogiri rot — Google’s markup shifts and your CSS selectors quietly return
nil.
The cheap way: one request
Standard library only — no gems:
require "net/http"
require "json"
uri = URI("https://api.serp.cheap/v1/search")
req = Net::HTTP::Post.new(uri, {
"X-API-Key" => ENV["SERP_CHEAP_API_KEY"],
"Content-Type" => "application/json",
})
req.body = { q: "best crm software", gl: "us" }.to_json
res = Net::HTTP.start(uri.host, uri.port, use_ssl: true) { |http| http.request(req) }
JSON.parse(res.body)["organic"].each do |r|
puts "#{r['position']}. #{r['title']}\n #{r['link']}"
end
No proxies, no browser, no parser to babysit.
Or use the official gem
gem install serpcheap
require "serpcheap"
client = SerpCheap::Client.new(ENV["SERP_CHEAP_API_KEY"])
res = client.search(q: "best crm software", gl: "us")
puts res.organic.first.title
On Rails? gem install serpcheap-rails adds an initializer and config so you inject the client anywhere.
What it costs
| Price per query | |
|---|---|
| Fresh result | $0.0006 |
| Cached result | $0.0003 |
| Free on signup | 100 searches |
Pay-as-you-go from $0.75/1k, credits valid 12 months — cheaper than the residential proxies a DIY scraper needs. See the cheapest SERP API comparison.
Parameters you’ll use
gl— country of results. See local SEO by country.hl— interface language.page— 1-indexed; see pagination.tbs— time filter for recent results.
Next
Try serp.cheap
Copy the snippet, add your key, and you’re scraping Google from Ruby. 100 free searches on signup — no card required; pay-as-you-go from $0.75/1k after that, and credits stay valid for 12 months.
- Get your free API key →
- Prefer paying by card? serp.cheap is also on RapidAPI (
$0.90/1k) and Apify ($1.50/1k).