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": [
"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",
"ce",
"ch",
"co",
"cr",
"cs",
"cse",
"csl",
"cv",
"cy",
"da",
"de",
"dsl",
"dv",
"dz",
"ee",
"el",
"en",
"eo",
"es",
"et",
"eu",
"fa",
"ff",
"fi",
"fj",
"fo",
"fr",
"fsl",
"fy",
"ga",
"gd",
"gl",
"gn",
"gsg",
"gu",
"gv",
"ha",
"he",
"hi",
"ho",
"hr",
"ht",
"hu",
"hy",
"hz",
"id",
"ig",
"ii",
"ik",
"is",
"it",
"iu",
"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",
"nn",
"no",
"nr",
"nv",
"ny",
"oc",
"oj",
"om",
"or",
"os",
"pa",
"pks",
"pl",
"ps",
"pt",
"qu",
"rm",
"rn",
"ro",
"rsl",
"ru",
"rw",
"sc",
"sd",
"sdl",
"se",
"sfs",
"sg",
"sh",
"si",
"sk",
"sl",
"sm",
"sn",
"so",
"sq",
"sr",
"ss",
"st",
"su",
"sv",
"sw",
"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"
"zh"
],
"qwant": [
"bg-BG",

View file

@ -22,7 +22,9 @@ about = {
categories = ["videos"]
paging = True
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
@ -92,5 +94,9 @@ def response(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