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?

More than 1 year has passed since last update.

PythonでYoutubeの動画をダウンロード

Posted at

備忘録

pythonでyoutubeの動画をダウンロードするやつ
main.py
import os
from yt_dlp import YoutubeDL

abs_path = os.path.dirname(__file__)

#オプションを指定(最高画質の動画と最高音質の音声を取り出し結合するためのオプション)
#実行ファイルと同じディレクトリにdataフォルダを作成してください
option = {
        'outtmpl' : str(abs_path) + '/data\original/%(title)s.%(ext)s',
        'format' : 'bestaudio/best'
    }

#インスタンスの生成
ydl = YoutubeDL(option)

#ダウンロードの実行
result = ydl.download(['https://www.youtube.com/watch?v=M2cckDmNLMI&list=PLItoQPoI2CslCLn2RKLEwe1IfgdjF5idU&index=2',
                        'https://www.youtube.com/watch?v=cCm5-S5GV2o',])

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?