mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-12-11 15:48:55 +00:00
[ard] Add support for lives (closes #13771)
This commit is contained in:
parent
e445850e69
commit
ca127ab2c1
|
@ -93,6 +93,7 @@ def _extract_media_info(self, media_info_url, webpage, video_id):
|
||||||
|
|
||||||
duration = int_or_none(media_info.get('_duration'))
|
duration = int_or_none(media_info.get('_duration'))
|
||||||
thumbnail = media_info.get('_previewImage')
|
thumbnail = media_info.get('_previewImage')
|
||||||
|
is_live = media_info.get('_isLive') is True
|
||||||
|
|
||||||
subtitles = {}
|
subtitles = {}
|
||||||
subtitle_url = media_info.get('_subtitleUrl')
|
subtitle_url = media_info.get('_subtitleUrl')
|
||||||
|
@ -106,6 +107,7 @@ def _extract_media_info(self, media_info_url, webpage, video_id):
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'duration': duration,
|
'duration': duration,
|
||||||
'thumbnail': thumbnail,
|
'thumbnail': thumbnail,
|
||||||
|
'is_live': is_live,
|
||||||
'formats': formats,
|
'formats': formats,
|
||||||
'subtitles': subtitles,
|
'subtitles': subtitles,
|
||||||
}
|
}
|
||||||
|
@ -166,9 +168,11 @@ def _real_extract(self, url):
|
||||||
# determine video id from url
|
# determine video id from url
|
||||||
m = re.match(self._VALID_URL, url)
|
m = re.match(self._VALID_URL, url)
|
||||||
|
|
||||||
|
document_id = None
|
||||||
|
|
||||||
numid = re.search(r'documentId=([0-9]+)', url)
|
numid = re.search(r'documentId=([0-9]+)', url)
|
||||||
if numid:
|
if numid:
|
||||||
video_id = numid.group(1)
|
document_id = video_id = numid.group(1)
|
||||||
else:
|
else:
|
||||||
video_id = m.group('video_id')
|
video_id = m.group('video_id')
|
||||||
|
|
||||||
|
@ -228,12 +232,16 @@ def _real_extract(self, url):
|
||||||
'formats': formats,
|
'formats': formats,
|
||||||
}
|
}
|
||||||
else: # request JSON file
|
else: # request JSON file
|
||||||
|
if not document_id:
|
||||||
|
video_id = self._search_regex(
|
||||||
|
r'/play/(?:config|media)/(\d+)', webpage, 'media id')
|
||||||
info = self._extract_media_info(
|
info = self._extract_media_info(
|
||||||
'http://www.ardmediathek.de/play/media/%s' % video_id, webpage, video_id)
|
'http://www.ardmediathek.de/play/media/%s' % video_id,
|
||||||
|
webpage, video_id)
|
||||||
|
|
||||||
info.update({
|
info.update({
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'title': title,
|
'title': self._live_title(title) if info.get('is_live') else title,
|
||||||
'description': description,
|
'description': description,
|
||||||
'thumbnail': thumbnail,
|
'thumbnail': thumbnail,
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue