为什么Curl会忽略给定的范围?

时间:2013-06-29 16:43:45

标签: curl youtube

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

(我使用的示例代码:)

  

curl --cookie “VISITOR_INFO1_LIVE = EIBGUtRnRx4;   人口统计= d9e6a6b806922b989c443b57cc40cf59e3QDAAAAYWdlaRQAAAB0BgAAAGdlbmRlcnQBAAAAbTA =;   s_tempdata-336183159 = EI = xBC_UeOJLs6hkgXB7oGwDw&安培; VED = CDcQvxs;   s_tempdata-3430648675 = EI = xBC_UeOJLs6hkgXB7oGwDw&安培; VED = CEwQvxs;   s_tempdata-877158463 = EI = xBC_UeOJLs6hkgXB7oGwDw&安培; VED = CF8Qvxs;   s_tempdata-2333910030 = EI = xBC_UeOJLs6hkgXB7oGwDw&安培; VED = CHsQvxs;   s_tempdata-3498387738 = EI = xBC_UeOJLs6hkgXB7oGwDw&安培; VED = CDIQvxs;   s_tempdata-106278690 = VED = CFcQvxs&安培; EI = Q9LCUfqrJMK0kgX3ioGgBw;   s_tempdata-1014563062 = VED = CFoQvxs&安培; EI = cxDEUf3OAsiekQXjiYCACA;   d9ji4.resume = uFMMXRoSxnA:183;   s_tempdata-1950472349 = EI = ywzMUcPiJqekmQXrtIC4Cw&安培; VED = CCMQvxs;   s_tempdata-350957551 = EI = UxDMUaWGJOTnmAWnmIHICg&安培; VED = CDMQvxs;   s_tempdata-3561588006 = EI = MD_MUZyPGeTnmAX3koHgBw&安培; VED = CDIQvxs;   s_tempdata-1460032003 = EI = 1VDOUbSyIYjOmgXtyYGAAQ&安培; VED = CA0Qvxs;   s_tempdata-2286494229 = EI = lFXOUfiMLerbmAXrgoG4Aw&安培; VED = CIABEL8b;   s_tempdata-1936772083 = EI = lFXOUfiMLerbmAXrgoG4Aw&安培; VED = CH0Qvxs;   s_tempdata-190970993 = FEATURE = G-高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; recently_watched_video_id_list = cc05ffe7b8a53d9d2dbcb9695b1b5354WwEAAABzCwAAAEhTZUltcWJWMzBz;活性= 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&signature=399599C4C262CCEAED9AB8AEA48A71DDFADFB7CF.08C556136636AFD52BE0318D3E4AECAC1ABFB7C5

1 个答案:

答案 0 :(得分:2)

似乎YouTube服务器不支持范围参数,或者忽略它。来自cURL docs

  

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

     

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