[Google Product Result API] Update the search query in the documentation
A customer reported that the code generated from the Google Product Result API documentation page results in a KeyError: 'product_result' after executing it. There is no longer a product_result returned in the results when searching for "iphone 11 pro":
There's a product_result returned in the response when searching for "iphone 15 pro max":
Hmm, perhaps there's a more stable product that could be used than a specific numbered iPhone model that's going to go out of date again in a few years?
How about "Montblanc Meisterstück 149 Fountain Pen"? Those have been in production since 1952 and don't look to be going anywhere.
I also note this shows a difference in semantics between our examples - Ruby and Python have opposite behaviour when it comes to failures in [] (KeyError for Python, nil for Ruby) and get/fetch (None for Python, KeyError in Ruby). I wonder if we want to encourage a particular style.
Related to https://github.com/serpapi/public-roadmap/issues/1040.
This seems to have been indirectly fixed with https://github.com/serpapi/SerpApi/pull/5824
The documentation has since been updated to use iPhone 14, which works:
require 'google_search_results'
params = {
q: "iphone 14",
device: "desktop",
api_key: "..."
}
search = GoogleSearch.new(params)
product_result = search.get_hash[:product_result]