aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl
diff options
context:
space:
mode:
authorSergey M․ <dstftw@gmail.com>2016-12-12 00:58:08 +0700
committerSergey M․ <dstftw@gmail.com>2016-12-12 00:58:08 +0700
commit3530e0d3d922c6e7289f0586c1e2febd2953b680 (patch)
treeea8c4c1fe5c89784f25e6e1b97754cffc94a9fd1 /youtube_dl
parentfb37eb25d9494d71ef9321154b4be759d4d64dca (diff)
[dplay] Use Safari user-agent for hls (closes #11418)
Diffstat (limited to 'youtube_dl')
-rw-r--r--youtube_dl/extractor/dplay.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/youtube_dl/extractor/dplay.py b/youtube_dl/extractor/dplay.py
index 5790553f3..32028bc3b 100644
--- a/youtube_dl/extractor/dplay.py
+++ b/youtube_dl/extractor/dplay.py
@@ -8,6 +8,7 @@ import time
from .common import InfoExtractor
from ..compat import compat_urlparse
from ..utils import (
+ USER_AGENTS,
int_or_none,
update_url_query,
)
@@ -102,10 +103,16 @@ class DPlayIE(InfoExtractor):
manifest_url, video_id, ext='mp4',
entry_protocol='m3u8_native', m3u8_id=protocol, fatal=False)
# Sometimes final URLs inside m3u8 are unsigned, let's fix this
- # ourselves
+ # ourselves. Also fragments' URLs are only served signed for
+ # Safari user agent.
query = compat_urlparse.parse_qs(compat_urlparse.urlparse(manifest_url).query)
for m3u8_format in m3u8_formats:
- m3u8_format['url'] = update_url_query(m3u8_format['url'], query)
+ m3u8_format.update({
+ 'url': update_url_query(m3u8_format['url'], query),
+ 'http_headers': {
+ 'User-Agent': USER_AGENTS['Safari'],
+ },
+ })
formats.extend(m3u8_formats)
elif protocol == 'hds':
formats.extend(self._extract_f4m_formats(