Open kipu44 opened 10 years ago
&hl=en has to be added to the url to make it work international.
Replace:
html = self.get_page('http://www.google.com/search?q=' + urllib2.quote(text))
With:
html = self.get_page('http://www.google.com/search?q=' + urllib2.quote(text) + '&hl=en')
The instruction: match = re.search(r'(?:Showing results for|Did you mean|Including results for)[^\0]?<a.?>(.*?)', html) finds something only if results are shown in English. When user is e.g. from Poland, (s)he gets the text 'Czy chodziło Ci o' instead of 'Did you mean' and the instruction shown above doesn't find anything. In my opinion, searching for '<span class="spell ng">' from '<span class="spell ng">Did you mean:</span>' or something similar would be much safer and universal.
<span class="spell ng">Did you mean:</span> <span class="spell ng">Czy chodziło Ci o:</span>