1
0
mirror of https://github.com/searx/searx synced 2024-12-04 08:00:43 +01:00

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

File diff suppressed because it is too large Load Diff

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

View File

@ -3,13 +3,9 @@
# this file is generated automatically by utils/fetch_languages.py
language_codes = \
( ('af-ZA', 'Afrikaans', '', 'Afrikaans'),
('am-ET', 'አማርኛ', '', 'Amharic'),
('ar-EG', 'العربية', '', 'Arabic'),
('az-AZ', 'Azərbaycan', '', 'Azerbaijani'),
('be-BY', 'Беларуская', '', 'Belarusian'),
('bg-BG', 'Български', '', 'Bulgarian'),
('bn-BD', 'বাংলা', '', 'Bangla'),
('bs-BA', 'Bosanski', '', 'Bosnian'),
('ca-ES', 'Català', '', 'Catalan'),
('cs-CZ', 'Čeština', '', 'Czech'),
('da-DK', 'Dansk', '', 'Danish'),
@ -36,7 +32,6 @@ language_codes = \
('et-EE', 'Eesti', '', 'Estonian'),
('fa-IR', 'فارسی', '', 'Persian'),
('fi-FI', 'Suomi', '', 'Finnish'),
('fo-FO', 'Føroyskt', '', 'Faroese'),
('fr', 'Français', '', 'French'),
('fr-BE', 'Français', 'Belgique', 'French'),
('fr-CA', 'Français', 'Canada', 'French'),
@ -50,20 +45,11 @@ language_codes = \
('is-IS', 'Íslenska', '', 'Icelandic'),
('it-IT', 'Italiano', '', 'Italian'),
('ja-JP', '日本語', '', 'Japanese'),
('ka-GE', 'ქართული', '', 'Georgian'),
('kk-KZ', 'Қазақ Тілі', '', 'Kazakh'),
('km-KH', 'ខ្មែរ', '', 'Khmer'),
('ko-KR', '한국어', '', 'Korean'),
('ky-KG', 'Кыргызча', '', 'Kyrgyz'),
('lo-LA', 'ລາວ', '', 'Lao'),
('lt-LT', 'Lietuvių', '', 'Lithuanian'),
('lv-LV', 'Latviešu', '', 'Latvian'),
('mk-MK', 'Македонски', '', 'Macedonian'),
('mn-MN', 'Монгол', '', 'Mongolian'),
('ms-MY', 'Melayu', '', 'Malay'),
('mt-MT', 'Malti', '', 'Maltese'),
('nb-NO', 'Norsk Bokmål', '', 'Norwegian Bokmål'),
('ne-NP', 'नेपाली', '', 'Nepali'),
('nl', 'Nederlands', '', 'Dutch'),
('nl-BE', 'Nederlands', 'België', 'Dutch'),
('nl-NL', 'Nederlands', 'Nederland', 'Dutch'),
@ -73,23 +59,14 @@ language_codes = \
('pt-PT', 'Português', 'Portugal', 'Portuguese'),
('ro-RO', 'Română', '', 'Romanian'),
('ru-RU', 'Русский', '', 'Russian'),
('rw-RW', 'Kinyarwanda', '', 'Kinyarwanda'),
('si-LK', 'සිංහල', '', 'Sinhala'),
('sk-SK', 'Slovenčina', '', 'Slovak'),
('sl-SI', 'Slovenščina', '', 'Slovenian'),
('so-SO', 'Soomaali', '', 'Somali'),
('sq-AL', 'Shqip', '', 'Albanian'),
('sr-RS', 'Srpski', '', 'Serbian'),
('sv-SE', 'Svenska', '', 'Swedish'),
('sw-TZ', 'Kiswahili', '', 'Swahili'),
('tg-TJ', 'Тоҷикӣ', '', 'Tajik'),
('th-TH', 'ไทย', '', 'Thai'),
('ti-ET', 'ትግርኛ', '', 'Tigrinya'),
('tk-TM', 'Türkmen Dili', '', 'Turkmen'),
('tr-TR', 'Türkçe', '', 'Turkish'),
('uk-UA', 'Українська', '', 'Ukrainian'),
('ur-PK', 'اردو', '', 'Urdu'),
('uz-UZ', 'OZbek', '', 'Uzbek'),
('vi-VN', 'Tiếng Việt', '', 'Vietnamese'),
('zh', '中文', '', 'Chinese'),
('zh-CN', '中文', '中国', 'Chinese'),