Merge pull request #131 from searxng/fix-peertube-languages

Fix peertube languages
This commit is contained in:
Markus Heiser 2021-06-04 14:26:22 +00:00 committed by GitHub
commit fb6dd416e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 175 deletions

View File

@ -25457,198 +25457,26 @@
} }
}, },
"peertube": [ "peertube": [
"aa",
"ab",
"af",
"ak",
"am",
"an",
"ar",
"as",
"ase",
"av",
"avk",
"ay",
"az",
"ba",
"be",
"bfi",
"bg",
"bi",
"bm",
"bn",
"bo",
"br",
"bs",
"bzs",
"ca", "ca",
"ce",
"ch",
"co",
"cr",
"cs", "cs",
"cse",
"csl",
"cv",
"cy",
"da",
"de", "de",
"dsl",
"dv",
"dz",
"ee",
"el", "el",
"en", "en",
"eo", "eo",
"es", "es",
"et",
"eu", "eu",
"fa",
"ff",
"fi", "fi",
"fj",
"fo",
"fr", "fr",
"fsl",
"fy",
"ga",
"gd", "gd",
"gl",
"gn",
"gsg",
"gu",
"gv",
"ha",
"he",
"hi",
"ho",
"hr",
"ht",
"hu",
"hy",
"hz",
"id",
"ig",
"ii",
"ik",
"is",
"it", "it",
"iu",
"ja", "ja",
"jbo",
"jsl",
"jv",
"ka",
"kg",
"ki",
"kj",
"kk",
"kl",
"km",
"kn",
"ko",
"kr",
"ks",
"ku",
"kv",
"kw",
"ky",
"lb",
"lg",
"li",
"ln",
"lo",
"lt",
"lu",
"lv",
"mg",
"mh",
"mi",
"mk",
"ml",
"mn",
"mr",
"ms",
"mt",
"my",
"na",
"nb",
"nd",
"ne",
"ng",
"nl", "nl",
"nn",
"no",
"nr",
"nv",
"ny",
"oc", "oc",
"oj",
"om",
"or",
"os",
"pa",
"pks",
"pl", "pl",
"ps",
"pt", "pt",
"qu",
"rm",
"rn",
"ro",
"rsl",
"ru", "ru",
"rw",
"sc",
"sd",
"sdl",
"se",
"sfs",
"sg",
"sh",
"si",
"sk",
"sl",
"sm",
"sn",
"so",
"sq",
"sr",
"ss",
"st",
"su",
"sv", "sv",
"sw", "zh"
"swl",
"ta",
"te",
"tg",
"th",
"ti",
"tk",
"tl",
"tlh",
"tn",
"to",
"tr",
"ts",
"tt",
"tw",
"ty",
"ug",
"uk",
"ur",
"uz",
"ve",
"vi",
"wa",
"wo",
"xh",
"yi",
"yo",
"za",
"zh",
"zu"
], ],
"qwant": [ "qwant": [
"bg-BG", "bg-BG",

View File

@ -22,7 +22,9 @@ about = {
categories = ["videos"] categories = ["videos"]
paging = True paging = True
base_url = "https://peer.tube" base_url = "https://peer.tube"
supported_languages_url = base_url + "/api/v1/videos/languages" supported_languages_url = (
'https://framagit.org/framasoft/peertube/search-index/-/raw/master/client/src/views/Search.vue'
)
# do search-request # do search-request
@ -92,5 +94,9 @@ def response(resp):
def _fetch_supported_languages(resp): def _fetch_supported_languages(resp):
peertube_languages = list(loads(resp.text).keys()) import re
# https://docs.python.org/3/howto/regex.html#greedy-versus-non-greedy
videolanguages = re.search(r"videoLanguages \(\) \{(.*?)\]", resp.text, re.DOTALL)
peertube_languages = [m.group(1) for m in re.finditer(r"\{ id: '([a-z]+)', label:", videolanguages.group(1))]
return peertube_languages return peertube_languages