aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/extractor
diff options
context:
space:
mode:
authorYen Chi Hsuan <yan12125@gmail.com>2016-05-27 00:03:03 +0800
committerYen Chi Hsuan <yan12125@gmail.com>2016-05-27 00:03:48 +0800
commit448bb5f333c6c4c8084e479e1035ff674e4f8fd4 (patch)
tree2d660eb11886ca5212becef3ac4dc2bf4002057c /youtube_dl/extractor
parent293c2556886c34d11919eb0af6760c52bd6a2632 (diff)
[common] Fix non-bootstrapped support in f4m
Diffstat (limited to 'youtube_dl/extractor')
-rw-r--r--youtube_dl/extractor/common.py19
-rw-r--r--youtube_dl/extractor/playwire.py2
2 files changed, 14 insertions, 7 deletions
diff --git a/youtube_dl/extractor/common.py b/youtube_dl/extractor/common.py
index b5bea5904..e53b7ad64 100644
--- a/youtube_dl/extractor/common.py
+++ b/youtube_dl/extractor/common.py
@@ -987,7 +987,7 @@ class InfoExtractor(object):
def _extract_f4m_formats(self, manifest_url, video_id, preference=None, f4m_id=None,
transform_source=lambda s: fix_xml_ampersands(s).strip(),
- fatal=True, assume_f4mv2=False, m3u8_id=None):
+ fatal=True, m3u8_id=None):
manifest = self._download_xml(
manifest_url, video_id, 'Downloading f4m manifest',
'Unable to download f4m manifest',
@@ -1001,12 +1001,11 @@ class InfoExtractor(object):
return self._parse_f4m_formats(
manifest, manifest_url, video_id, preference=preference, f4m_id=f4m_id,
- transform_source=transform_source, fatal=fatal, assume_f4mv2=assume_f4mv2,
- m3u8_id=m3u8_id)
+ transform_source=transform_source, fatal=fatal, m3u8_id=m3u8_id)
def _parse_f4m_formats(self, manifest, manifest_url, video_id, preference=None, f4m_id=None,
transform_source=lambda s: fix_xml_ampersands(s).strip(),
- fatal=True, assume_f4mv2=False, m3u8_id=None):
+ fatal=True, m3u8_id=None):
# currently youtube-dl cannot decode the playerVerificationChallenge as Akamai uses Adobe Alchemy
akamai_pv = manifest.find('{http://ns.adobe.com/f4m/1.0}pv-2.0')
if akamai_pv is not None and ';' in akamai_pv.text:
@@ -1036,8 +1035,16 @@ class InfoExtractor(object):
'bootstrap info', default=None)
for i, media_el in enumerate(media_nodes):
- if manifest_version == '2.0' or assume_f4mv2:
- media_url = media_el.attrib.get('href') or media_el.attrib.get('url')
+ # If <bootstrapInfo> is present, the specified f4m is a
+ # stream-level manifest, and only set-level manifests may refer to
+ # external resources. See section 11.4 and section 4 of F4M spec
+ if bootstrap_info is None:
+ media_url = None
+ # @href is introduced in 2.0, see section 11.6 of F4M spec
+ if manifest_version == '2.0':
+ media_url = media_el.attrib.get('href')
+ if media_url is None:
+ media_url = media_el.attrib.get('url')
if not media_url:
continue
manifest_url = (
diff --git a/youtube_dl/extractor/playwire.py b/youtube_dl/extractor/playwire.py
index 2ee5c5aa3..0bc743118 100644
--- a/youtube_dl/extractor/playwire.py
+++ b/youtube_dl/extractor/playwire.py
@@ -60,7 +60,7 @@ class PlaywireIE(InfoExtractor):
thumbnail = content.get('poster')
src = content['media']['f4m']
- formats = self._extract_f4m_formats(src, video_id, assume_f4mv2=True, m3u8_id='hls')
+ formats = self._extract_f4m_formats(src, video_id, m3u8_id='hls')
for a_format in formats:
if not dict_get(a_format, ['tbr', 'width', 'height']):
a_format['quality'] = 1 if '-hd.' in a_format['url'] else 0