3

我需要使用 Curl 下载 Youtube 视频的特定部分。(假设我要下载前 2MB)我正在使用 Curl 中的-r开关来实现这一点。它适用于非 youtube 链接,但我用 -r 指定的范围对于 Youtube 链接将被忽略。Curl 下载整个视频文件,而不是下载我想要的块。我怎样才能做到这一点?
提前致谢!

(我使用的示例代码:)

卷曲--cookies_tempdata-1460032003=ei=1VDOUbSyIYjOmgXtyYGAAQ&ved=CA0Qvxs; s_tempdata-2286494229=ei=lFXOUfiMLerbmAXrgoG4Aw&ved=CIABEL8b; s_tempdata-1936772083=ei=lFXOUfiMLerbmAXrgoG4Aw&ved=CH0Qvxs; s_tempdata-190970993=特征=g-high-crv&ei=S9zOUZzYLsi3ygHS9YD4BA&ved=CIgBEPklKAE; __utma=27069237.288981257.1372343761.1372343761.1372511855.2; __utmb=27069237.5.10.1372511855; __utmz=27069237.1372343761.1.1.utmcsr=(直接)|utmccn=(直接)|utmcmd=(无); __utmc=27069237; YSC=TwN0bcR_vzM;最近观看的视频id列表=cc05ffe7b8a53d9d2dbcb9695b1b5354WwEAAABzCwAAAEhTZUltcWJWMzBz;活动=1372523413722;PREF=f1=50000000&fv=11.2.202&al=en;" s_tempdata-190970993=特征=g-high-crv&ei=S9zOUZzYLsi3ygHS9YD4BA&ved=CIgBEPklKAE; __utma=27069237.288981257.1372343761.1372343761.1372511855.2; __utmb=27069237.5.10.1372511855; __utmz=27069237.1372343761.1.1.utmcsr=(直接)|utmccn=(直接)|utmcmd=(无); __utmc=27069237; YSC=TwN0bcR_vzM;最近观看的视频id列表=cc05ffe7b8a53d9d2dbcb9695b1b5354WwEAAABzCwAAAEhTZUltcWJWMzBz;活动=1372523413722;PREF=f1=50000000&fv=11.2.202&al=en;" s_tempdata-190970993=特征=g-high-crv&ei=S9zOUZzYLsi3ygHS9YD4BA&ved=CIgBEPklKAE; __utma=27069237.288981257.1372343761.1372343761.1372511855.2; __utmb=27069237.5.10.1372511855; __utmz=27069237.1372343761.1.1.utmcsr=(直接)|utmccn=(直接)|utmcmd=(无); __utmc=27069237; YSC=TwN0bcR_vzM;最近观看的视频id列表=cc05ffe7b8a53d9d2dbcb9695b1b5354WwEAAABzCwAAAEhTZUltcWJWMzBz;活动=1372523413722;PREF=f1=50000000&fv=11.2.202&al=en;" 活动=1372523413722;PREF=f1=50000000&fv=11.2.202&al=en;" 活动=1372523413722;PREF=f1=50000000&fv=11.2.202&al=en;"-o ~/Downloads/File.part -r 0-2000000 " http://r4---sn-nau-jhcl.c.youtube.com/videoplayback?id=1d27889aa6d5df4b&ipbits=8&factor=1.25&ms=au&mt=1372523374&fexp= 925614%2C906370%2C912519%2C904825%2C900222%2C909546%2C906397%2C928201%2C929123%2C929915%2C929906%2C929907%2C929125%2C929127%2C925714%2C929917%2C929919%2C931202%2C912512%2C912515%2C912521%2C906838%2C906840%2C931913%2C904830% 2C919373%2C933701%2C904122%2C900816%2C909421%2C912711%2C907228&mv=m&burst=40&algorithm=throttle-factor&expire=1372545822&sver=3&source=youtube&newshard=yes&cp=U0hWR1VPU19HTENONl9NSVdJOkNGQUpTdVJvVnY0&upn=a9WEy2DAZiY&ip=103.21.166.17&key=yt1&itag=34&sparams=algorithm%2Cburst%2Ccp%2Cfactor %2Cid%2Cip%2Cipbits%2Citag%2Csource%2Cupn%2Cexpire&签名=399599C4C262CCEAED9AB8AEA48A71DDFADFB7CF.08C556136636AFD52BE0318D3E4AECAC1ABFB7C5 “

4

1 回答 1

2

YouTube 服务器似乎不支持 range 参数,或者他们忽略了它。来自cURL 文档

4.11 为什么我的 HTTP 范围请求会返回完整的文档?

因为服务器可能不支持该范围,或者服务器可能会选择忽略它并返回完整的文档。

于 2013-06-29T16:54:24.280 回答