Zum Herunterladen von Videos von Bilibili kann weder youtube-dl noch annie verwendet werden.

Zum Herunterladen von Videos von Bilibili kann weder youtube-dl noch annie verwendet werden.

Ich habe also versucht, mit Annie ein Video von Bilibili herunterzuladen. Ursprünglich habe ich youtube-dl gewählt, aber leider scheint es die Bilibili-Website nicht zu unterstützen, also habe ich stattdessen Annie gewählt, gemäß dem Rat vonein Reddit-Benutzer Aber trotz allem habe ich mit Annie auch kein Glück. Ich frage mich, ob das daran liegt, dass Bilibili seinen Mechanismus aktualisiert hat oder ob ich irgendwo einen Fehler gemacht habe. Dies ist der Code.

apple@apples-MacBook-Pro ~ % annie "https://www.bilibili.com/s/video/BV1TD4y1R7k2"
Downloading https://www.bilibili.com/s/video/BV1TD4y1R7k2 error:
this page has no playlist
apple@apples-MacBook-Pro ~ % 

Außerdem behauptet youtube-dl, es unterstütztBilibiliund ich erinnere mich definitiv daran, vor nicht allzu langer Zeit ein Video von Bilibili mit youtube-dl heruntergeladen zu haben. Was ist also passiert? Hat Bilibili seinen Code aktualisiert oder so?

apple@apples-MacBook-Pro ~ % youtube-dl "https://www.bilibili.com/video/av90163846?p=1"
[BiliBili] 90163846: Downloading webpage
[BiliBili] 90163846: Downloading video info page
WARNING: Unable to download JSON metadata: HTTP Error 412: Precondition Failed
[BiliBili] 90163846: Downloading video info page
ERROR: Unable to download JSON metadata: HTTP Error 412: Precondition Failed (caused by 
HTTPError()); please report this issue on https://yt-dl.org/bug . Make sure you are using 
the latest version; type  youtube-dl -U  to update. Be sure to call youtube-dl with the -- 
verbose flag and include its complete output.
apple@apples-MacBook-Pro ~ % 

Bearbeiten: Hier ist das Debug-Protokoll, falls es hilft.

 apple@192 ~ % youtube-dl -v "https://bilibili.com/video/BV1TD4y1R7k2"         
[debug] System config: [u'--format', u'mp4', u'-o', u'~/Desktop/%(title)s.%(ext)s', u'--write-sub', u'--embed-subs']
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: [u'-v', u'https://bilibili.com/video/BV1TD4y1R7k2']
[debug] Encodings: locale UTF-8, fs utf-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2021.03.14
[debug] Python version 2.7.16 (CPython) - Darwin-20.3.0-x86_64-i386-64bit
[debug] exe versions: ffmpeg 4.3.1, ffprobe 4.3.1, rtmpdump 2.4
[debug] Proxy map: {}
[BiliBili] 1TD4y1R7k2: Downloading webpage
[BiliBili] 1TD4y1R7k2: Downloading video info page
ERROR: requested format not available
Traceback (most recent call last):
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 806, in wrapper
    return func(self, *args, **kwargs)
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 838, in __extract_info
    return self.process_ie_result(ie_result, download, extra_info)
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 872, in process_ie_result
    return self.process_video_result(ie_result, download=download)
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 1675, in process_video_result
    expected=True)
ExtractorError: requested format not available

apple@192 ~ % 

Antwort1

Um das Problem zu beheben, müssen Sie zwei Dinge tun:

  1. Aktualisieren Sie auf die aktuelle Version von youtube-dl. Der Bilibili-Extraktor wurde zuletzt am 8. März 2021 geändert und als ich ihn mit einer älteren Version testete, funktionierte er nicht
  2. Verwenden Sie Bilibili-URLs, die wie die Eingabe für youtube-dl aussehen https://www.bilibili.com/video/BV1TD4y1R7k2. Verwenden Sie keine Bilibili-URLs wie das erste Beispiel, das eine/S/darin. Anstelle von https://www.bilibili.com/s/video/BV1TD4y1R7k2sollten Sie also verwendenhttps://www.bilibili.com/video/BV1TD4y1R7k2

Antwort2

Fügen Sie dem Befehl Folgendes hinzu

--add-header Akzeptieren:'/'

verwandte Informationen