1
0
mirror of https://codeberg.org/polarisfm/youtube-dl synced 2024-10-31 22:44:32 +01:00

[extractor/common] Recognize DASH formats in html5 media entries

This commit is contained in:
Sergey M․ 2016-12-17 23:03:13 +07:00
parent 93753aad20
commit 87a449c1ed
No known key found for this signature in database
GPG Key ID: 2C393E0F18A9236D

View File

@ -1888,7 +1888,7 @@ class InfoExtractor(object):
}) })
return formats return formats
def _parse_html5_media_entries(self, base_url, webpage, video_id, m3u8_id=None, m3u8_entry_protocol='m3u8'): def _parse_html5_media_entries(self, base_url, webpage, video_id, m3u8_id=None, m3u8_entry_protocol='m3u8', mpd_id=None):
def absolute_url(video_url): def absolute_url(video_url):
return compat_urlparse.urljoin(base_url, video_url) return compat_urlparse.urljoin(base_url, video_url)
@ -1905,11 +1905,16 @@ class InfoExtractor(object):
def _media_formats(src, cur_media_type): def _media_formats(src, cur_media_type):
full_url = absolute_url(src) full_url = absolute_url(src)
if determine_ext(full_url) == 'm3u8': ext = determine_ext(full_url)
if ext == 'm3u8':
is_plain_url = False is_plain_url = False
formats = self._extract_m3u8_formats( formats = self._extract_m3u8_formats(
full_url, video_id, ext='mp4', full_url, video_id, ext='mp4',
entry_protocol=m3u8_entry_protocol, m3u8_id=m3u8_id) entry_protocol=m3u8_entry_protocol, m3u8_id=m3u8_id)
elif ext == 'mpd':
is_plain_url = False
formats = self._extract_mpd_formats(
full_url, video_id, mpd_id=mpd_id)
else: else:
is_plain_url = True is_plain_url = True
formats = [{ formats = [{