小编pem*_*ock的帖子

Python youtube-dl 是否可以获取合并文件的扩展名?

当我运行它时:

ydl_opts = {
    'outtmpl': files_path + '%(id)s.%(ext)s',
}
        with youtube_dl.YoutubeDL(ydl_opts) as ydl:
            ydl.download([video_url])
Run Code Online (Sandbox Code Playgroud)

我在日志中得到它:

[ffmpeg] Merging formats into "/home/tmp/0uBOtQOO70Y.mkv"
[wsgi:error] Deleting original file /home/tmp/0uBOtQOO70Y.f137.mp4 (pass -k to keep)
[wsgi:error] Deleting original file /home/tmp/0uBOtQOO70Y.f251.webm (pass -k to keep)
Run Code Online (Sandbox Code Playgroud)

下载之前或之后如何获取/home/tmp/0uBOtQOO70Y.mkv ?

如果我做到了:

ydl_opts = {}
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
     info = ydl.extract_info(video_url, download=False)
Run Code Online (Sandbox Code Playgroud)

然后信息中是mp4扩展名

python youtube-dl

5
推荐指数
1
解决办法
1325
查看次数

标签 统计

python ×1

youtube-dl ×1