This article introduces a method to download Niconico videos with youtube-dl.
I opened Niconico for the first time in a year. Nothing’s changed.
Niconico is not as straightforward as other sites.
I got an ERROR: unable to download video data: HTTP Error 403: Forbidden error.
- [[niconico] Downloading long videos requires heartbeat signals · Issue #14582 · ytdl-org/youtube-dl](https://github.com/ytdl-org/youtube-dl/issues/14582) - [Unable to download from nicovideo.jp · Issue #19261 · ytdl-org/youtube-dl](https://github.com/ytdl-org/youtube-dl/issues/19261)As a workaround, I recommend you to tried re-downloading the video for multiple times until it succeeds.
As a temporary solution, the following script works. Put your cookies in cookie_niconico.txt.
ydlNiconico(){
LC_ALL=en_US.UTF-8 \
youtube-dl -i -v \
-o "/mnt/e/_videos/_youtube_dl/_niconico/%(id)s--%(title)s--%(uploader)s.%(ext)s" \
--cookies /home/data/youtube-dl/cookie_niconico.txt --download-archive /home/data/youtube-dl/archive.txt \
--embed-subs --embed-thumbnail --write-info-json --all-subs --sub-format srt \
"$(cuturlquerystr "$1")"
}
while [[ true ]]; do ydlNiconico "https://www.nicovideo.jp/watch/sm12345" && break || continue ; done
I just noticed until is easier.
until ydlNiconico "https://www.nicovideo.jp/watch/sm12345"; do :; done