nittolese / gquestions

Find "People Also Ask" questions
GNU General Public License v3.0
59 stars 36 forks source link

Wrong language parameter in Google's url #7

Open ownchoice opened 5 years ago

ownchoice commented 5 years ago

I found this error because while trying to use the module for language agnostic searches (I don't know if it's the right way to call them) in Spanish, I got all the questions in English. For example, names of things that are spelled the same in both English and Spanish.

For the selection of the language, the script uses the parameter hl but that is the web interface language, instead the lr parameter should be used since it sets the search language.

For reference: https://sites.google.com/site/tomihasa/google-language-codes

Now, my problem is, changing the line 78 of gquestions.py from: browser.get("https://www.google.com?hl=es") To: browser.get("https://www.google.com?hl=es&lr=lang_es") Does provide me with the search results in the correct language but I see no questions at the end and the script fails.

ownchoice commented 5 years ago

Testing a little bit more, I guess I'm having this problem just because there are no questions in Spanish for the topic that I searched, because for other topics I do find questions in Spanish using lr=lang_es.