diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2011-05-10 12:53:25 +0200 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2011-05-10 12:53:25 +0200 |
commit | 3e96282cc12d4aacfce314a954ca602f0d89b92a (patch) | |
tree | 8d7155df7c5025eb452da911b0f2e5152ddfb3b0 /data/rbot/plugins | |
parent | f52f485ae68a62cd6183224ba535c88a35928768 (diff) |
search: update gdef to changes in web result
Diffstat (limited to 'data/rbot/plugins')
-rw-r--r-- | data/rbot/plugins/search.rb | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/data/rbot/plugins/search.rb b/data/rbot/plugins/search.rb index 4e13f3e7..60a70c54 100644 --- a/data/rbot/plugins/search.rb +++ b/data/rbot/plugins/search.rb @@ -21,7 +21,7 @@ GOOGLE_WAP_SEARCH = "http://www.google.com/m/search?hl=en&q=" GOOGLE_WAP_LINK = /<a href="(?:.*?u=(.*?)|(http:\/\/.*?))">(.*?)<\/a>/im GOOGLE_CALC_RESULT = %r{<img src=/images/calc_img\.gif(?: width=40 height=30 alt="")?>.*?<h[1-6] class=r[^>]*><b>(.+?)</b>} GOOGLE_COUNT_RESULT = %r{<font size=-1>Results <b>1<\/b> - <b>10<\/b> of about <b>(.*)<\/b> for} -GOOGLE_DEF_RESULT = %r{<a href="([^"]*)"[^>]*>(Web definitions for .*?)<br/>(.*?)<br/>(.*?)\s-\s+<a href} +GOOGLE_DEF_RESULT = %r{<br/>\s*(.*?)\s*<br/>\s*(.*?)<a href="(/dictionary\?[^"]*)"[^>]*>(More ยป)\s*</a>\s*<br/>} GOOGLE_TIME_RESULT = %r{alt="Clock"></td><td valign=[^>]+>(.+?)<(br|/td)>} class SearchPlugin < Plugin @@ -248,11 +248,10 @@ class SearchPlugin < Plugin return end - gdef_link = "http://www.google.com" + CGI.unescapeHTML(results[0][0]) # could be used to extract all defs - head = results[0][1].ircify_html - text = results[0][2].ircify_html - link = results[0][3] - m.reply "#{head} -- #{link}\n#{text}" + gdef_link = "http://www.google.com" + CGI.unescapeHTML(results[0][2]) # could be used to extract all defs + head = results[0][0].ircify_html + text = results[0][1].ircify_html + m.reply "#{head} -- #{text}" ### gdef_link could be used for something like # html_defs = @bot.httputil.get(gdef_link) |