mirror of
https://github.com/searxng/searxng.git
synced 2025-07-16 01:39:24 +02:00
[fix] fetch google's supported languages
This commit is contained in:
parent
51111c2594
commit
0169b63e84
3 changed files with 27218 additions and 26970 deletions
|
@ -381,10 +381,10 @@ def attributes_to_html(attributes):
|
|||
def _fetch_supported_languages(resp):
|
||||
supported_languages = {}
|
||||
dom = html.fromstring(resp.text)
|
||||
options = dom.xpath('//table//td/font/label/span')
|
||||
options = dom.xpath('//*[@id="langSec"]//input[@name="lr"]')
|
||||
for option in options:
|
||||
code = option.xpath('./@id')[0][1:]
|
||||
name = option.text.title()
|
||||
code = option.xpath('./@value')[0].split('_')[-1]
|
||||
name = option.xpath('./@data-name')[0].title()
|
||||
supported_languages[code] = {"name": name}
|
||||
|
||||
return supported_languages
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue