aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThe Hatsune Daishi <nao20010128@gmail.com>2021-09-23 18:06:48 +0900
committerGitHub <noreply@github.com>2021-09-23 14:36:48 +0530
commitee2b3563f367bf6644f58e16212262af8a664f6f (patch)
tree2e37d208d32c3abba8cf8e3bc80f1bc57f4581ac
parentbdc196a444303575bd9122b34763decbe16df2d2 (diff)
downloadhypervideo-pre-ee2b3563f367bf6644f58e16212262af8a664f6f.tar.lz
hypervideo-pre-ee2b3563f367bf6644f58e16212262af8a664f6f.tar.xz
hypervideo-pre-ee2b3563f367bf6644f58e16212262af8a664f6f.zip
[downloader/niconico] Pass custom headers (#1063)
Closes #1057 Authored by: nao20010128nao
-rw-r--r--yt_dlp/downloader/niconico.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/yt_dlp/downloader/niconico.py b/yt_dlp/downloader/niconico.py
index 256840d68..521dfece3 100644
--- a/yt_dlp/downloader/niconico.py
+++ b/yt_dlp/downloader/niconico.py
@@ -6,7 +6,7 @@ import threading
from .common import FileDownloader
from ..downloader import get_suitable_downloader
from ..extractor.niconico import NiconicoIE
-from ..compat import compat_urllib_request
+from ..utils import sanitized_Request
class 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)