]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/commitdiff
search: skip non-search-results link
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Tue, 17 Aug 2010 07:24:12 +0000 (09:24 +0200)
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Tue, 17 Aug 2010 07:24:12 +0000 (09:24 +0200)
This prevents the regexp scan to grab the Google Privacy link when no
results were found.

data/rbot/plugins/search.rb

index aec8b1345611a2994a23f711e3573664ed7c6f81..8b3b6848d11800084a22ac93a9b64d3c13802207 100644 (file)
@@ -90,7 +90,7 @@ class SearchPlugin < Plugin
       m.reply "error googling for #{what}"
       return
     end
-    results = wml.scan(GOOGLE_WAP_LINK)
+    results = wml.match('<p align="center">').pre_match.scan(GOOGLE_WAP_LINK)
 
     if results.length == 0
       m.reply "no results found for #{what}"