如何在 Python 中使用 youtube-dl 提取所有 .mp4? [英] How to extract all .mp4 with youtube-dl in Python?

查看:23
本文介绍了如何在 Python 中使用 youtube-dl 提取所有 .mp4?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试编写一个 Python 脚本,该脚本可以提取 .mp4 文件格式的任何视频的下载链接.为此,我使用 youtube-dl 但它以 .m3u8 文件格式返回视频链接.如何以 .mp4 文件格式获取它们?

I'm trying to write a Python script that can extract the download link of any video in .mp4 file format. For this I'm using youtube-dl but it returns the video link in .m3u8 file format. How can I get them in .mp4 file format?

推荐答案

格式化mp4代码:

  • 137:1080p
  • 136:720p
  • 135:480p
  • 134:360p
  • 133:240p

  • 137: 1080p
  • 136: 720p
  • 135: 480p
  • 134: 360p
  • 133: 240p

import youtube_dl

url = 'https://twitter.com/PassengersMovie/status/821025484150423557'

with youtube_dl.YoutubeDL({'format':'137'}) as ydl:
    ydl.download([url])

这篇关于如何在 Python 中使用 youtube-dl 提取所有 .mp4?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆