Skip to content

Commit

Permalink
[periscope] pass referer to HLS requests(closes #29419)
Browse files Browse the repository at this point in the history
  • Loading branch information
remitamine committed Jun 28, 2021
1 parent 379f52a commit 7fb9564
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion youtube_dl/extractor/periscope.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@


class PeriscopeBaseIE(InfoExtractor):
_M3U8_HEADERS = {
'Referer': 'https://www.periscope.tv/'
}

def _call_api(self, method, query, item_id):
return self._download_json(
'https://api.periscope.tv/api/v2/%s' % method,
Expand Down Expand Up @@ -54,9 +58,11 @@ def _extract_pscp_m3u8_formats(self, m3u8_url, video_id, format_id, state, width
m3u8_url, video_id, 'mp4',
entry_protocol='m3u8_native'
if state in ('ended', 'timed_out') else 'm3u8',
m3u8_id=format_id, fatal=fatal)
m3u8_id=format_id, fatal=fatal, headers=self._M3U8_HEADERS)
if len(m3u8_formats) == 1:
self._add_width_and_height(m3u8_formats[0], width, height)
for f in m3u8_formats:
f.setdefault('http_headers', {}).update(self._M3U8_HEADERS)
return m3u8_formats


Expand Down

0 comments on commit 7fb9564

Please sign in to comment.