Youtube_dl: エラー: YouTube から「ビデオデータを抽出できません」というメッセージが表示されました 質問する

Youtube_dl: エラー: YouTube から「ビデオデータを抽出できません」というメッセージが表示されました 質問する

私は、YouTube 動画をその URL とともにダウンロードする小さなグラフィック インターフェイスを Python 3 で作成しています。youtube_dlそのためにモジュールを使用しました。これが私のコードです:

import youtube_dl # Youtube_dl is used for download the video

ydl_opt = {"outtmpl" : "/videos/%(title)s.%(ext)s", "format": "bestaudio/best"} # Here we give some advanced settings. outtmpl is used to define the path of the video that we are going to download

def operation(link):
    """
    Start the download operation
    """
    try:
        with youtube_dl.YoutubeDL(ydl_opt) as yd: # The method YoutubeDL() take one argument which is a dictionary for changing default settings
            video = yd.download([link]) # Start the download
        result.set("Your video has been downloaded !")
    except Exception:
        result.set("Sorry, we got an error.")

operation("https://youtube.com/watch?v=...")

コードを実行すると、次のエラーが発生します:

ERROR: YouTube said: Unable to extract video data

私が見たここビデオ情報が見つからないためだということですが、どうすればこの問題を解決できますか?

ベストアンサー1

youtube-dl を更新すると解決しました。インストール方法に応じて、コマンドは次のとおりです。

  • youtube-dl --update(自己更新)
  • pip install -U youtube-dl(Python経由)
  • brew upgrade youtube-dl(macOS + 自作)
  • choco upgrade youtube-dl(Windows + Chocolatey)

おすすめ記事