[extractor/bilibili] Fix path "/audio/auxxxxx" download return 403
authorlihan7 <lihan7@xiaomi.com>
Fri, 25 Mar 2022 07:46:28 +0000 (15:46 +0800)
committerdirkf <fieldhouse@gmx.net>
Thu, 31 Mar 2022 23:46:34 +0000 (00:46 +0100)
youtube_dl/extractor/bilibili.py

index bff6ea194d7ad9a39f7fc79cede427abdf3d8279..d42f0e98a4b2e76efb598225a0a0c63913555a6a 100644 (file)
@@ -369,6 +369,11 @@ class BilibiliAudioIE(BilibiliAudioBaseIE):
             'filesize': int_or_none(play_data.get('size')),
         }]
 
+        for a_format in formats:
+            a_format.setdefault('http_headers', {}).update({
+                'Referer': url,
+            })
+
         song = self._call_api('song/info', au_id)
         title = song['title']
         statistic = song.get('statistic') or {}