lib/boxcars/boxcar/google_search.rb in boxcars-0.4.2 vs lib/boxcars/boxcar/google_search.rb in boxcars-0.4.3
- old
+ new
@@ -48,14 +48,15 @@
%i[answer_box snippet],
[:answer_box, :snippet_highlighted_words, 0],
%i[sports_results game_spotlight],
%i[knowledge_graph description],
[:organic_results, 0, :snippet],
- [:organic_results, 0, :snippet_highlighted_words, 0]
+ [:organic_results, 0, :snippet_highlighted_words, 0],
+ [:organic_results, 0, :title]
].freeze
def find_answer(res)
- raise Error, "Got error from SerpAPI: {res[:error]}" if res[:error]
+ raise Error, "Got error from SerpAPI: #{res[:error]}" if res[:error]
ANSWER_LOCATIONS.each do |path|
next unless res.dig(*path)
Boxcars.debug("Found SERP answer at #{path}", :cyan)