Merge pull request #221 from dalf/fix-peertube_fetch_supported_languages

[fix] peertube: update _fetch_supported_languages
This commit is contained in:
Alexandre Flament 2021-07-25 10:30:53 +02:00 committed by GitHub
commit 48fe83b901
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -97,6 +97,6 @@ def _fetch_supported_languages(resp):
import re import re
# https://docs.python.org/3/howto/regex.html#greedy-versus-non-greedy # https://docs.python.org/3/howto/regex.html#greedy-versus-non-greedy
videolanguages = re.search(r"videoLanguages \(\) \{(.*?)\]", resp.text, re.DOTALL) 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))] peertube_languages = [m.group(1) for m in re.finditer(r"\{ id: '([a-z]+)', label:", videolanguages.group(1))]
return peertube_languages return peertube_languages