如何在 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])