2016-07-27 132 views
0

------------------------------ Format Numbers Numbers ------ -------------------------------------------------- --------------youtube-dl用formatid下载视频

  • 249 WEBM只有音频的音频DASH 52K,OPUS @ 50K,629.08KiB
  • 250 WEBM只有音频的音频DASH 69K,OPUS @ 70K,811.98 KIB
  • 171 WEBM只有音频的音频DASH 110K,Vorbis格式@ 128K,1.27MiB
  • 140 M4A只有音频的音频DASH 128K,m4a_dash容器,[email protected],1。 56MiB
  • 251 WEBM只有音频的音频DASH 138K,OPUS @ 160K,1.53MiB
  • 278 WEBM 254x144 144P 82K,WEBM容器,VP9,13fps,仅视频,772.69KiB
  • 242 WEBM 400x226 240P 101K,VP9, 25fps的,仅视频,884.56KiB
  • 160 MP4 254x144 144P 112K,avc1.4d400c,13fps,仅视频,1.31MiB
  • 133 MP4 400x226 240P 265K,avc1.4d400d,25fps的,仅视频,2.92MiB
  • 17 3gp 176x144 small,mp4v.20.3,mp4a.40.2 @ 24k
  • 36 3GP看见320×180小,mp4v.20.3,mp4a.40.2
  • 18 MP4 400x226介质,avc1.42001E,mp4a.40.2 @ 96K
  • 43 WEBM为640x360介质,vp8.0,Vorbis格式@ 128K(最好)

我想在程序中使用的数字格式这样

import youtube_dl 

url = "https://www.youtube.com/watch?v=BaW_jenozKc" 
ydl_opts = { 
    'verbose': True, 
    'format': 'bestaudio/best', #maybe like this 'formatid'= 22 
    'outtmpl': '%(title)s-%(id)s.%(ext)s', 
    'noplaylist': True, 
} 
with youtube_dl.YoutubeDL(ydl_opts) as ydl: 
    ydl.download([url]) 

我怎么能做到这一点

回答

1

如果你真的想格式化22,那么确实,PA ss format密钥22。如果22不可用,您可以使用/best回退到最佳视频格式:

ydl_opts = { 
    'format': '22/best', 
    ... 
+0

lol其如此简单:D谢谢 – stackrangerflow