fetch google's search langs rather than ui langs

This commit is contained in:
Marc Abonce Seguin 2020-09-20 23:01:06 -07:00 committed by Alexandre Flament
parent c86504b47a
commit ecf5899153
3 changed files with 482 additions and 1441 deletions

View file

@ -282,11 +282,11 @@ def _fetch_supported_languages(resp):
ret_val = {}
dom = html.fromstring(resp.text)
radio_buttons = eval_xpath(dom, '//*[@id="langSec"]//input[@name="lang"]')
radio_buttons = eval_xpath(dom, '//*[@id="langSec"]//input[@name="lr"]')
for x in radio_buttons:
name = x.get("data-name")
code = x.get("value")
code = x.get("value").split('_')[-1]
ret_val[code] = {"name": name}
return ret_val