0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

pythonでYouTubeの動画をダウンロード

Posted at

pythonでYouTubeの動画をダウンロードする方法

pip install yt-dlp
import yt_dlp as youtube_dl

def download_channel_videos(channel_url):
    # ダウンロードオプションを定義
    ydl_opts = {
        'format': 'best',  # 動画の最適なフォーマットをダウンロード
        'outtmpl': '%(title)s.%(ext)s',  # 保存するファイル名のフォーマット
        'ignoreerrors': True  # エラーがあっても処理を継続する
    }

    with youtube_dl.YoutubeDL(ydl_opts) as ydl:
        ydl.download([channel_url])

# チャンネルのURLを指定
channel_url = 'https://www.youtube.com/@/チャンネルのID/videos'
download_channel_videos(channel_url)

特定のチャンネル動画を一括DL
このコードはYouTubeの利用規約や著作権に関する法律に遵守する範囲で使用

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?