mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-12-02 11:26:41 +00:00
[dfb] extract m3u8 formats
This commit is contained in:
parent
cef3f3011f
commit
65a3bfb379
|
@ -12,39 +12,46 @@ class DFBIE(InfoExtractor):
|
||||||
|
|
||||||
_TEST = {
|
_TEST = {
|
||||||
'url': 'http://tv.dfb.de/video/u-19-em-stimmen-zum-spiel-gegen-russland/11633/',
|
'url': 'http://tv.dfb.de/video/u-19-em-stimmen-zum-spiel-gegen-russland/11633/',
|
||||||
# The md5 is different each time
|
'md5': 'ac0f98a52a330f700b4b3034ad240649',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': '11633',
|
'id': '11633',
|
||||||
'display_id': 'u-19-em-stimmen-zum-spiel-gegen-russland',
|
'display_id': 'u-19-em-stimmen-zum-spiel-gegen-russland',
|
||||||
'ext': 'flv',
|
'ext': 'mp4',
|
||||||
'title': 'U 19-EM: Stimmen zum Spiel gegen Russland',
|
'title': 'U 19-EM: Stimmen zum Spiel gegen Russland',
|
||||||
'upload_date': '20150714',
|
'upload_date': '20150714',
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
mobj = re.match(self._VALID_URL, url)
|
display_id, video_id = re.match(self._VALID_URL, url).groups()
|
||||||
video_id = mobj.group('id')
|
|
||||||
display_id = mobj.group('display_id')
|
|
||||||
|
|
||||||
webpage = self._download_webpage(url, display_id)
|
|
||||||
player_info = self._download_xml(
|
player_info = self._download_xml(
|
||||||
'http://tv.dfb.de/server/hd_video.php?play=%s' % video_id,
|
'http://tv.dfb.de/server/hd_video.php?play=%s' % video_id,
|
||||||
display_id)
|
display_id)
|
||||||
video_info = player_info.find('video')
|
video_info = player_info.find('video')
|
||||||
|
stream_access_url = self._proto_relative_url(video_info.find('url').text.strip())
|
||||||
|
|
||||||
f4m_info = self._download_xml(
|
formats = []
|
||||||
self._proto_relative_url(video_info.find('url').text.strip()), display_id)
|
# see http://tv.dfb.de/player/js/ajax.js for the method to extract m3u8 formats
|
||||||
token_el = f4m_info.find('token')
|
for sa_url in (stream_access_url, stream_access_url + '&area=&format=iphone'):
|
||||||
manifest_url = token_el.attrib['url'] + '?' + 'hdnea=' + token_el.attrib['auth'] + '&hdcore=3.2.0'
|
stream_access_info = self._download_xml(sa_url, display_id)
|
||||||
formats = self._extract_f4m_formats(manifest_url, display_id)
|
token_el = stream_access_info.find('token')
|
||||||
|
manifest_url = token_el.attrib['url'] + '?' + 'hdnea=' + token_el.attrib['auth']
|
||||||
|
if '.f4m' in manifest_url:
|
||||||
|
formats.extend(self._extract_f4m_formats(
|
||||||
|
manifest_url + '&hdcore=3.2.0',
|
||||||
|
display_id, f4m_id='hds', fatal=False))
|
||||||
|
else:
|
||||||
|
formats.extend(self._extract_m3u8_formats(
|
||||||
|
manifest_url, display_id, 'mp4',
|
||||||
|
'm3u8_native', m3u8_id='hls', fatal=False))
|
||||||
self._sort_formats(formats)
|
self._sort_formats(formats)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'display_id': display_id,
|
'display_id': display_id,
|
||||||
'title': video_info.find('title').text,
|
'title': video_info.find('title').text,
|
||||||
'thumbnail': self._og_search_thumbnail(webpage),
|
'thumbnail': 'http://tv.dfb.de/images/%s_640x360.jpg' % video_id,
|
||||||
'upload_date': unified_strdate(video_info.find('time_date').text),
|
'upload_date': unified_strdate(video_info.find('time_date').text),
|
||||||
'formats': formats,
|
'formats': formats,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue