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>
![screenshot from 2014-05-09 23 15 35](https://cloud.githubusercontent.com/assets/5730312/2933466/5e7b9c12-d7bf-11e3-8535-f01757e52e05.png)