Skip to content

Commit

Permalink
[dplay] Use Safari user-agent for hls (closes #11418)
Browse files Browse the repository at this point in the history
  • Loading branch information
dstftw authored and calbrecht committed Dec 26, 2016
1 parent bd78116 commit 368844e
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions youtube_dl/extractor/dplay.py
Expand Up @@ -8,6 +8,7 @@
from .common import InfoExtractor
from ..compat import compat_urlparse
from ..utils import (
USER_AGENTS,
int_or_none,
update_url_query,
)
Expand Down Expand Up @@ -102,10 +103,16 @@ def extract_formats(protocol, manifest_url):
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(
Expand Down

0 comments on commit 368844e

Please sign in to comment.