Compare commits

...

5 Commits

Author SHA1 Message Date
Patrick Menschel
b5d656ac73 Fix Flake8 Issues. 2023-11-03 16:52:24 +01:00
Patrick Menschel
e50c253023 Fix ytdlp's own requirements.txt ! v2
Remove duplicate of pycryptodomex
2023-11-03 16:44:54 +01:00
Patrick Menschel
904819e08b Fix ytdlp's own requirements.txt ! 2023-11-03 16:43:49 +01:00
Patrick Menschel
a3833fc5de Fix ytdlp's own CI script! v2 2023-11-03 16:38:47 +01:00
Patrick Menschel
02539fabe2 Fix ytdlp's own CI script! 2023-11-03 16:28:11 +01:00
3 changed files with 21 additions and 11 deletions

View File

@ -15,7 +15,7 @@ jobs:
with:
python-version: '3.11'
- name: Install test requirements
run: pip install pytest pycryptodomex
run: pip install -r requirements.txt
- name: Run tests
run: |
python3 -m yt_dlp -v || true

View File

@ -6,3 +6,6 @@ brotlicffi; platform_python_implementation!='CPython'
certifi
requests>=2.31.0,<3
urllib3>=1.26.17,<3
# test
pytest

View File

@ -19,6 +19,8 @@ def _generate_video_specific_cache_url(slug, parent_slug):
"""
return 'https://de-api.loma-cms.com/feloma/page/{0}/?environment=tele5&parent_slug={1}&v=2'.format(slug,
parent_slug)
def _do_cached_post(s: requests.session,
referer: str,
url: str) -> dict:
@ -45,6 +47,7 @@ def _do_cached_post(s: requests.session,
r.raise_for_status()
return r.json()
class Tele5IE(DPlayIE): # XXX: Do not subclass from concrete IE
_VALID_URL = r'https?://(?:www\.)?tele5\.de/(?:[^/]+/)*(?P<id>[^/?#&]+)'
_GEO_COUNTRIES = ['DE']
@ -128,17 +131,20 @@ class Tele5IE(DPlayIE): # XXX: Do not subclass from concrete IE
}]
def _real_extract(self, url):
content_regex = re.compile(r'https?://(?:www\.)?(?P<environment>[^.]+)\.de/(?P<parent_slug>[^/]+)/(?P<slug>[^/?#&]+)')
content_regex = re.compile(
r'https?://(?:www\.)?(?P<environment>[^.]+)\.de/(?P<parent_slug>[^/]+)/(?P<slug>[^/?#&]+)')
m = content_regex.search(url)
if m is not None:
environment, parent_slug, slug = m.groups()
s = requests.session()
headers_for_origin = {'User-Agent': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/113.0'}
headers_for_origin = {
'User-Agent': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/113.0'}
r = s.get(url=url,
headers=headers_for_origin)
r.raise_for_status()
cached_base = _do_cached_post(s=s,
cached_base = _do_cached_post(
s=s,
referer=url,
url='https://de-api.loma-cms.com/feloma/configurations/?environment={0}'.format(environment))
@ -149,7 +155,8 @@ class Tele5IE(DPlayIE): # XXX: Do not subclass from concrete IE
sonic_endpoint = compat_urlparse.urlparse(player_info['sonicEndpoint']).hostname
country = site_info['info']['country']
cached_video_specific = _do_cached_post(s=s, referer=url,
cached_video_specific = _do_cached_post(s=s,
referer=url,
url=_generate_video_specific_cache_url(
slug=slug,
parent_slug=parent_slug))