mirror of
https://github.com/searxng/searxng.git
synced 2024-12-23 17:50:29 +00:00
peertube engine: update _fetch_supported_languages
There is now an API to get the list of supported languages https://docs.joinpeertube.org/api-rest-reference.html#tag/Video/operation/getLanguages
This commit is contained in:
parent
6b71721ce8
commit
8256de2fe8
1 changed files with 3 additions and 8 deletions
|
@ -22,9 +22,7 @@ about = {
|
||||||
categories = ["videos"]
|
categories = ["videos"]
|
||||||
paging = True
|
paging = True
|
||||||
base_url = "https://peer.tube"
|
base_url = "https://peer.tube"
|
||||||
supported_languages_url = (
|
supported_languages_url = 'https://peer.tube/api/v1/videos/languages'
|
||||||
'https://framagit.org/framasoft/peertube/search-index/-/raw/master/client/src/views/Search.vue'
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
# do search-request
|
# do search-request
|
||||||
|
@ -84,9 +82,6 @@ def response(resp):
|
||||||
|
|
||||||
|
|
||||||
def _fetch_supported_languages(resp):
|
def _fetch_supported_languages(resp):
|
||||||
import re
|
videolanguages = resp.json()
|
||||||
|
peertube_languages = list(videolanguages.keys())
|
||||||
# https://docs.python.org/3/howto/regex.html#greedy-versus-non-greedy
|
|
||||||
videolanguages = re.search(r"videoLanguages \(\)[^\n]+(.*?)\]", 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
|
||||||
|
|
Loading…
Reference in a new issue