Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Jul 8th, 2012  |  syntax: None  |  size: 2.50 KB  |  views: 74  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. How can I find download links for vimeo videos?
  2. http://vimeo.com/moogaloop/play/clip:6649390/1eab2a25f30f1aadaf5e306d0f40fd6c/1292498602/?q=hd
  3.        
  4. http://av.vimeo.com/02047/623/34209065.mp4?token=1292496582_34de09a6d13212cf26af08357d311c30
  5.        
  6. $video_link = "http://vimeo.com/moogaloop/play/clip:".$video_id."/".$request_signature."/".$request_signature_expires."/?q=".$quality."";
  7.        
  8. public function actionVimeo($video_id)
  9.     {
  10.         $xml_url = "http://vimeo.com/moogaloop/load/clip:$video_id";
  11.  
  12.         $ch = curl_init($xml_url);          
  13.         $cookieFile = Yii::app()->basePath . '/runtime/vimeocookie'. time().'.txt'; //replace this line with code to generate a writeable path in your application
  14.         curl_setopt($ch, CURLOPT_COOKIEJAR, $cookieFile); //the cookie file will be populated with cookies received while viewing the xml page  
  15.         curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); //you need to send a user agent here and it must be the same below when you visit the video url
  16.         curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  17.         $output = curl_exec($ch);
  18.         curl_close($ch);
  19.  
  20.  
  21.         $xml = simplexml_load_string($output);
  22.         $request_signature = $xml->request_signature;
  23.         $request_signature_expires = $xml->request_signature_expires;
  24.         $vid_url = "http://vimeo.com/moogaloop/play/clip:".$video_id."/".$request_signature."/".$request_signature_expires."/?q=sd";
  25.  
  26.         $ch = curl_init();
  27.         curl_setopt($ch, CURLOPT_URL,$vid_url);        
  28.         curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);  //same user agent as on previous vimeo page you visited      
  29.         curl_setopt($ch, CURLOPT_COOKIEFILE, $cookieFile); //the cookies in that cookie file will be used while visiting the video URL        
  30.         curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); //vimeo changes the header location, so you gotta follow it
  31.         curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  32.         $video = curl_exec($ch);
  33.         curl_close($ch);
  34.  
  35.         unlink($cookieFile); //remove the temporary cookie file
  36.  
  37.         $savePath = Yii::app()->basePath . '/runtime/testvim.mp4'; //change this to a path your application can write the final video to
  38.         file_put_contents($savePath, $video);
  39.  
  40.         exit;
  41.     }
  42.        
  43. http://vimeo.com/moogaloop/load/clip:6649390
  44.        
  45. XML Parsing Error: XML or text declaration not at start of entity
  46. Location: http://vimeo.com/moogaloop/load/clip:6649390
  47. Line Number 1, Column 5:    <?xml version="1.0" encoding="utf-8"?>
  48. ----^