From fa639cb4885f63e887493afbd4e0dbacbe4a0e99 Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Mon, 10 Sep 2012 06:33:32 +0200 Subject: [PATCH] search: fix google calc scraping --- data/rbot/plugins/search.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/data/rbot/plugins/search.rb b/data/rbot/plugins/search.rb index 0a439708..0e80a2d8 100644 --- a/data/rbot/plugins/search.rb +++ b/data/rbot/plugins/search.rb @@ -18,7 +18,7 @@ GOOGLE_SEARCH = "http://www.google.com/search?oe=UTF-8&q=" GOOGLE_WAP_SEARCH = "http://www.google.com/m/search?hl=en&q=" GOOGLE_WAP_LINK = /"r">(?:]*>)?]*>(.*?)<\/a>/im -GOOGLE_CALC_RESULT = %r{.*?]*>(.+?)} +GOOGLE_CALC_RESULT = %r{]*>(.+?)Results 1<\/b> - 10<\/b> of about (.*)<\/b> for} GOOGLE_DEF_RESULT = %r{onebox_result">\s*(.*?)\s*
\s*(.*?)]+>(.+?)<(br|/td)>} @@ -202,7 +202,7 @@ class SearchPlugin < Plugin debug "#{html.size} bytes of html recieved" debug html - candidates = html.match(/font-weight:bold">(.*?)<\/(?:span|div)>/) + candidates = html.match(GOOGLE_CALC_RESULT) debug "candidates: #{candidates.inspect}" if candidates.nil? -- 2.32.0.93.g670b81a890