1
0
Fork 0
mirror of https://github.com/ytdl-org/youtube-dl.git synced 2024-11-24 19:22:06 +00:00

[dplay] Use Safari user-agent for hls (closes #11418)

This commit is contained in:
Sergey M․ 2016-12-12 00:58:08 +07:00
parent fb37eb25d9
commit 3530e0d3d9
No known key found for this signature in database
GPG key ID: 2C393E0F18A9236D

View file

@ -8,6 +8,7 @@ import time
from .common import InfoExtractor from .common import InfoExtractor
from ..compat import compat_urlparse from ..compat import compat_urlparse
from ..utils import ( from ..utils import (
USER_AGENTS,
int_or_none, int_or_none,
update_url_query, update_url_query,
) )
@ -102,10 +103,16 @@ class DPlayIE(InfoExtractor):
manifest_url, video_id, ext='mp4', manifest_url, video_id, ext='mp4',
entry_protocol='m3u8_native', m3u8_id=protocol, fatal=False) entry_protocol='m3u8_native', m3u8_id=protocol, fatal=False)
# Sometimes final URLs inside m3u8 are unsigned, let's fix this # 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) query = compat_urlparse.parse_qs(compat_urlparse.urlparse(manifest_url).query)
for m3u8_format in m3u8_formats: 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) formats.extend(m3u8_formats)
elif protocol == 'hds': elif protocol == 'hds':
formats.extend(self._extract_f4m_formats( formats.extend(self._extract_f4m_formats(