aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRemita Amine <remitamine@gmail.com>2016-08-22 07:47:25 +0100
committerRemita Amine <remitamine@gmail.com>2016-08-22 07:49:34 +0100
commitc7c43a93ba4abbd2175ab0891b63def7e25aa385 (patch)
tree05a3fceedfe3dc4485e4745eabc74186c933e0de
parent96229e5f95a5be622a694b464085bdea59134ccf (diff)
[common] add helper method to extract akamai m3u8 and f4m formats
-rw-r--r--youtube_dl/extractor/common.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/youtube_dl/extractor/common.py b/youtube_dl/extractor/common.py
index ba4c03d3d..8ed16deee 100644
--- a/youtube_dl/extractor/common.py
+++ b/youtube_dl/extractor/common.py
@@ -1765,6 +1765,18 @@ class InfoExtractor(object):
entries.append(media_info)
return entries
+ def _extract_akamai_formats(self, manifest_url, video_id):
+ formats = []
+ f4m_url = re.sub(r'(https?://.+?)/i/', r'\1/z/', manifest_url).replace('/master.m3u8', '/manifest.f4m')
+ formats.extend(self._extract_f4m_formats(
+ update_url_query(f4m_url, {'hdcore': '3.7.0'}),
+ video_id, f4m_id='hds', fatal=False))
+ m3u8_url = re.sub(r'(https?://.+?)/z/', r'\1/i/', manifest_url).replace('/manifest.f4m', '/master.m3u8')
+ formats.extend(self._extract_m3u8_formats(
+ m3u8_url, video_id, 'mp4', 'm3u8_native',
+ m3u8_id='hls', fatal=False))
+ return formats
+
def _live_title(self, name):
""" Generate the title for a live video """
now = datetime.datetime.now()