A feature-rich command-line audio/video downloader
[downloader/niconico] Pass custom headers (#1063)
The Hatsune Daishiee2b3563f367
diff --git a/yt_dlp/downloader/niconico.py b/yt_dlp/downloader/niconico.pyindex 256840d689..521dfece31 100644--- a/yt_dlp/downloader/niconico.py+++ b/yt_dlp/downloader/niconico.py@@ -6,7 +6,7 @@ import threadingfrom .common import FileDownloaderfrom ..downloader import get_suitable_downloaderfrom ..extractor.niconico import NiconicoIE-from ..compat import compat_urllib_request+from ..utils import sanitized_Requestclass NiconicoDmcFD(FileDownloader):@@ -29,9 +29,11 @@ class NiconicoDmcFD(FileDownloader):heartbeat_data = heartbeat_info_dict['data'].encode()heartbeat_interval = heartbeat_info_dict.get('interval', 30)+ request = sanitized_Request(heartbeat_url, heartbeat_data)+def heartbeat():try:- compat_urllib_request.urlopen(url=heartbeat_url, data=heartbeat_data)+ self.ydl.urlopen(request).read()except Exception:self.to_screen('[%s] Heartbeat failed' % self.FD_NAME)