mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-09-22 02:11:26 +02:00
Compare commits
5 Commits
89b6befb65
...
b5d656ac73
Author | SHA1 | Date | |
---|---|---|---|
|
b5d656ac73 | ||
|
e50c253023 | ||
|
904819e08b | ||
|
a3833fc5de | ||
|
02539fabe2 |
2
.github/workflows/quick-test.yml
vendored
2
.github/workflows/quick-test.yml
vendored
|
@ -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
|
||||
|
|
|
@ -5,4 +5,7 @@ brotli; platform_python_implementation=='CPython'
|
|||
brotlicffi; platform_python_implementation!='CPython'
|
||||
certifi
|
||||
requests>=2.31.0,<3
|
||||
urllib3>=1.26.17,<3
|
||||
urllib3>=1.26.17,<3
|
||||
|
||||
# test
|
||||
pytest
|
|
@ -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,19 +131,22 @@ 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,
|
||||
referer=url,
|
||||
url='https://de-api.loma-cms.com/feloma/configurations/?environment={0}'.format(environment))
|
||||
cached_base = _do_cached_post(
|
||||
s=s,
|
||||
referer=url,
|
||||
url='https://de-api.loma-cms.com/feloma/configurations/?environment={0}'.format(environment))
|
||||
|
||||
site_info = cached_base.get('data').get('settings').get('site')
|
||||
player_info = site_info.get('player')
|
||||
|
@ -149,10 +155,11 @@ 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,
|
||||
url=_generate_video_specific_cache_url(
|
||||
slug=slug,
|
||||
parent_slug=parent_slug))
|
||||
cached_video_specific = _do_cached_post(s=s,
|
||||
referer=url,
|
||||
url=_generate_video_specific_cache_url(
|
||||
slug=slug,
|
||||
parent_slug=parent_slug))
|
||||
|
||||
video_id = cached_video_specific['data']['blocks'][1]['videoId']
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user