google-spell-check icon indicating copy to clipboard operation
google-spell-check copied to clipboard

The package works only when the user gets the Google's results in English

Open kipu44 opened this issue 10 years ago • 1 comments

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> screenshot from 2014-05-09 23 15 20 <span class="spell ng">Czy chodziło Ci o:</span> screenshot from 2014-05-09 23 15 35

kipu44 avatar May 09 '14 21:05 kipu44

&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')

FRVisser avatar Jan 15 '15 21:01 FRVisser