mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-09-22 02:11:26 +02:00
Compare commits
No commits in common. "a13e338f6fb8f9b6fd7734067fba12f072268f64" and "b5d656ac7309f36a7a574b5766883807e4c7a196" have entirely different histories.
a13e338f6f
...
b5d656ac73
|
@ -74,13 +74,13 @@ class DPlayBaseIE(InfoExtractor):
|
|||
:return: A dictionary with {content_type: url_to_content_type} scheme.
|
||||
"""
|
||||
if api_version == 3:
|
||||
video_playback_info_url = urljoin(base=disco_base, url='playback/v3/videoPlaybackInfo')
|
||||
video_playback_info_url = urljoin(base=disco_base, url="playback/v3/videoPlaybackInfo")
|
||||
|
||||
request_json_content = {
|
||||
'deviceInfo': {'adBlocker': False, # deviceInfo is mandatory, some keys inside are optional!
|
||||
'drmSupported': False,
|
||||
"deviceInfo": {"adBlocker": False, # deviceInfo is mandatory, some keys inside are optional!
|
||||
"drmSupported": False,
|
||||
},
|
||||
'videoId': '{0}'.format(video_id),
|
||||
"videoId": "{0}".format(video_id),
|
||||
}
|
||||
|
||||
video_playback_response = requests.post(url=video_playback_info_url,
|
||||
|
@ -90,9 +90,10 @@ class DPlayBaseIE(InfoExtractor):
|
|||
video_playback_response.raise_for_status()
|
||||
|
||||
streaming_list = video_playback_response.json()['data']['attributes']['streaming']
|
||||
streaming_item_protection = streaming_list[0]['protection']
|
||||
streaming_item = streaming_list[0]
|
||||
streaming_item_protection = streaming_item.get("protection")
|
||||
|
||||
assert streaming_item_protection.get('drmEnabled') is False
|
||||
assert streaming_item_protection.get("drmEnabled") is False
|
||||
else:
|
||||
# old behaviour
|
||||
streaming = self._download_json(
|
||||
|
@ -114,9 +115,9 @@ class DPlayBaseIE(InfoExtractor):
|
|||
})
|
||||
disco_base = 'https://%s/' % disco_host
|
||||
if api_version == 3:
|
||||
url_base = '://'.join(urlsplit(url)[:2])
|
||||
url_base = "://".join(urlsplit(url)[:2])
|
||||
headers = {
|
||||
'Referer': urljoin(base=url_base, url='/'),
|
||||
'Referer': urljoin(base=url_base, url="/"),
|
||||
'Origin': url_base,
|
||||
}
|
||||
else:
|
||||
|
|
|
@ -7,11 +7,6 @@ from ..compat import compat_urlparse
|
|||
from ..utils import (
|
||||
ExtractorError,
|
||||
)
|
||||
from ..version import __version__ as package_version
|
||||
|
||||
|
||||
def get_default_user_agent() -> str:
|
||||
return 'yt-dpl {0}'.format(package_version)
|
||||
|
||||
|
||||
def _generate_video_specific_cache_url(slug, parent_slug):
|
||||
|
@ -41,15 +36,15 @@ def _do_cached_post(s: requests.session,
|
|||
"""
|
||||
r = s.post(url='https://tele5.de/cached',
|
||||
headers={
|
||||
'Origin': 'https://tele5.de',
|
||||
'Referer': referer,
|
||||
'User-Agent': get_default_user_agent(),
|
||||
# Referer is a mandatory key,
|
||||
'User-Agent': 'Youtube-DL',
|
||||
# User-Agent is a mandatory key, it can be anything!
|
||||
},
|
||||
json={'path': url}
|
||||
)
|
||||
try:
|
||||
r.raise_for_status()
|
||||
except requests.exceptions.HTTPError as e:
|
||||
raise ExtractorError("Post to Loma-CMS failed {0}".format(e.__traceback__))
|
||||
r.raise_for_status()
|
||||
return r.json()
|
||||
|
||||
|
||||
|
@ -71,51 +66,6 @@ class Tele5IE(DPlayIE): # XXX: Do not subclass from concrete IE
|
|||
'tags': [],
|
||||
'thumbnail': 'https://eu1-prod-images.disco-api.com/2023/10/02/501fa839-d3ac-3c04-aa61-57f98802c532.jpeg',
|
||||
},
|
||||
}, {
|
||||
'url': 'https://tele5.de/mediathek/giganten-mit-staehlernen-faeusten',
|
||||
'info_dict': {
|
||||
'id': '5561439',
|
||||
'title': 'Giganten mit stählernen Fäusten',
|
||||
'ext': 'mp4',
|
||||
'timestamp': 1697235900,
|
||||
'description': 'md5:80489c885ae763b0f7fb74c65bbbdbde',
|
||||
'creator': 'Tele5',
|
||||
'tags': [],
|
||||
'series': 'Giganten mit stählernen Fäusten',
|
||||
'duration': 4690.68,
|
||||
'upload_date': '20231013',
|
||||
'thumbnail': 'https://eu1-prod-images.disco-api.com/2023/09/28/274524f7-e71d-334b-9971-c0c439eca577.jpeg',
|
||||
},
|
||||
}, {
|
||||
'url': 'https://tele5.de/mediathek/ein-koenigreich-vor-unserer-zeit',
|
||||
'info_dict': {
|
||||
'id': '5467119',
|
||||
'ext': 'mp4',
|
||||
'duration': 4506.6,
|
||||
'description': 'md5:7670c325232d54cb1fb0e1cb91770431',
|
||||
'creator': 'Tele5',
|
||||
'title': 'Ein Königreich vor unserer Zeit',
|
||||
'timestamp': 1695422100,
|
||||
'tags': [],
|
||||
'series': 'Ein Königreich vor unserer Zeit',
|
||||
'upload_date': '20230922',
|
||||
'thumbnail': 'https://eu1-prod-images.disco-api.com/2023/09/13/4fb0ad33-9644-3c9b-8e5e-71db184e029e.jpeg',
|
||||
},
|
||||
}, {
|
||||
'url': 'https://tele5.de/mediathek/im-reich-der-amazonen',
|
||||
'info_dict': {
|
||||
'id': '5503913',
|
||||
'ext': 'mp4',
|
||||
'series': 'Im Reich der Amazonen',
|
||||
'duration': 4811.76,
|
||||
'creator': 'Tele5',
|
||||
'description': 'md5:fb4a571d008806eb09f4818e2240a106',
|
||||
'thumbnail': 'https://eu1-prod-images.disco-api.com/2023/09/18/df0205cd-9dd8-3368-a31b-7f9c28f99021.jpeg',
|
||||
'timestamp': 1696025700,
|
||||
'title': 'Im Reich der Amazonen',
|
||||
'tags': [],
|
||||
'upload_date': '20230929',
|
||||
},
|
||||
}, {
|
||||
'url': 'https://www.tele5.de/mediathek/filme-online/videos?vid=1549416',
|
||||
'only_matching': True,
|
||||
|
@ -184,13 +134,11 @@ class Tele5IE(DPlayIE): # XXX: Do not subclass from concrete IE
|
|||
content_regex = re.compile(
|
||||
r'https?://(?:www\.)?(?P<environment>[^.]+)\.de/(?P<parent_slug>[^/]+)/(?P<slug>[^/?#&]+)')
|
||||
m = content_regex.search(url)
|
||||
if m is None:
|
||||
raise ExtractorError('Could not parse url {0} to environment, parent_slug, slug'.format(url))
|
||||
else:
|
||||
if m is not None:
|
||||
environment, parent_slug, slug = m.groups()
|
||||
s = requests.session()
|
||||
headers_for_origin = {
|
||||
'User-Agent': get_default_user_agent()}
|
||||
'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()
|
||||
|
@ -200,21 +148,20 @@ class Tele5IE(DPlayIE): # XXX: Do not subclass from concrete IE
|
|||
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')
|
||||
|
||||
sonic_realm = player_info['sonicRealm']
|
||||
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))
|
||||
|
||||
try:
|
||||
site_info = cached_base['data']['settings']['site']
|
||||
country = site_info['info']['country']
|
||||
player_info = site_info['player']
|
||||
sonic_realm = player_info['sonicRealm']
|
||||
sonic_endpoint = compat_urlparse.urlparse(player_info['sonicEndpoint']).hostname
|
||||
video_id = cached_video_specific['data']['blocks'][1]['videoId']
|
||||
except (KeyError, TypeError):
|
||||
raise ExtractorError('Could not extract Meta Data from loma-cms')
|
||||
video_id = cached_video_specific['data']['blocks'][1]['videoId']
|
||||
|
||||
try:
|
||||
return self._get_disco_api_info(url=url,
|
||||
|
|
Loading…
Reference in New Issue
Block a user