如何通过curl或wget下载WWDC 2010视频?

时间:2016-07-20 11:22:55

标签: ios curl wget wwdc

例如:https://developer.apple.com/devcenter/download.action?path=/videos/wwdc_2010__hd/session_122__accessibility_on_iphone_os.mov

当我进入

curl https://developer.apple.com/devcenter/download.action?path=/videos/wwdc_2010__hd/session_122__accessibility_on_iphone_os.mov > ~/Desktop/122.mov

wget https://developer.apple.com/devcenter/download.action?path=/videos/wwdc_2010__hd/session_122__accessibility_on_iphone_os.mov > ~/Desktop/122.mov

两者都失败了,只下载了一个333KB的文件。

1 个答案:

答案 0 :(得分:0)

您获得的mov文件只是一个参考文件,用于选择更正网络连接的文件。

如果你有一个mplayer,你可以尝试mplayer <url> -dumpstream -dumpfile <filename>

您也可以打开文件并找到正确的真实文件的文件名。

此外,您可以编写一些脚本来解析参考文件。 这是我在perl中编写的一个函数,用于解析mov ref文件:

sub parseMov
{
    $uri = $_[0];
    $result_uri = "";
    @arr_uris = ();

    my $content = get $uri;

    $content =~ "/[^[:print:]]//g";

    @arr_movs = split("rmdr", $content);

    foreach (@arr_movs)
    {   
       @arr_parts = split("url", $_);
       my $file = $arr_parts[-1];

       if (index($file, ".mov") != -1 || index($file, ".3gp") != -1 || index($file, ".m4v") != -1) 
       {
           #remove first char
           $file = trim($file);
           $file = substr($file,4);
           push( @arr_uris, $file);
       }
   }

   #determine basePath
   my @pathComponents = split("/", $uri);
   $basePath = $uri;
   $basePath =~ s/$pathComponents[-1]//;

   my $biggestSize = 0;

   #get biggest file
   foreach (@arr_uris)
   {
       $uri_item = "$basePath$_";

       my $size = getFilesize($uri_item);

       if ($size > $biggestSize)
       {
          $finalURL = $uri_item;
          $biggestSize = $size;
       }

   }

   #remove %00 and %10 chars
   $finalURL =~ s/\x10//;
   $finalURL =~ s/\x00*//g;

   return $finalURL;

}