[cspan] Pass Referer header with format's video URL (#26032) (closes #25729)
authorRoman Beránek <zavorka@users.noreply.github.com>
Mon, 30 Nov 2020 18:14:29 +0000 (19:14 +0100)
committerGitHub <noreply@github.com>
Mon, 30 Nov 2020 18:14:29 +0000 (01:14 +0700)
youtube_dl/extractor/cspan.py

index 67d6df4b0eb285f588b1352eae4a46e0c4b220fd..3356cc280f6393563008a435f55033cb2b0dc82a 100644 (file)
@@ -165,6 +165,8 @@ class CSpanIE(InfoExtractor):
                 formats = self._extract_m3u8_formats(
                     path, video_id, 'mp4', entry_protocol='m3u8_native',
                     m3u8_id='hls') if determine_ext(path) == 'm3u8' else [{'url': path, }]
+            for f in formats:
+                f.setdefault('http_headers', {})['Referer'] = url
             self._sort_formats(formats)
             entries.append({
                 'id': '%s_%d' % (video_id, partnum + 1),