Dieser Artikel stellt eine Methode vor, um Niconico-Videos mit youtube-dl herunterzuladen.
Ich habe Niconico zum ersten Mal seit einem Jahr geöffnet. Es hat sich nichts geändert.
Niconico ist nicht so einfach wie andere Seiten.
Ich habe einen ERROR: unable to download video data: HTTP Error 403: Forbidden-Fehler erhalten.
- [[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.
Als vorübergehende Lösung funktioniert das folgende Skript. Legen Sie Ihre Cookies in cookie_niconico.txt ab.
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
Ich habe gerade bemerkt, dass until einfacher ist.
until ydlNiconico "https://www.nicovideo.jp/watch/sm12345"; do :; done