PHP

Veoh’s Video Downloader

Here is the script that you can use to download videos from veoh.com. I wrote this script to bid a project at rentacoder.com and finished the code within half an hour. Consist of three functions and you can put them all into a class. But I prefer let them apart.

// this is used to get url content
function get_url_content($url){
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $url);
$data = curl_exec($ch);
curl_close($ch);
return $data;
}// this function used to retrieve value inbetween specific delimiter
function get_inbetween($tag1,$tag2,$string) {
if (eregi(“$tag1(.*)$tag2”, $string, $out)) {
$outdata = $out[1];
}
return $outdata;
}

// this function used to download music from veoh.com
// URL: http://www.veoh.com/videos/v1734061jbnYFjPj
function get_veoh($url){

// get the music_id
$ari = explode(“/”,$url);
$v_id = array_pop($ari);

// retrieve xml files
$data = get_url_content(“http://www.veoh.com/rest/video/”.$v_id.”/details”);

// retrieve path into music files
$hasil = get_inbetween(“fullPreviewHashPath”,”fullPreviewToken=”,$data);
$hasil = str_replace(array(‘”‘,’=’),””,$hasil);

// yell it loud
return trim($hasil);
}

echo get_veoh(“http://www.veoh.com/videos/v1734061jbnYFjPj”);
?>

5 Comments

  1. jimbo jones

    hi there!

    nicte tool. but there seems to be a problem.

    first of you need to rework the line “$hasil = str_replace(array(‘”‘,’=’),””,$hasil);” because current links have a “=” in the url.

    deleting this line gets a link to a flv file which is at max 25mb and like 6 minutes.

    could this be revised? i guess the scene needs a tool like this.

    regards,
    jj

  2. muthucheliyan

    Hi ,

    May i know how i can use this code???

  3. Does

    This does not work! 🙁

  4. Any idea what the password and username would be when it tries to retrieve the file from content.veoh.com

  5. konsumer

    This doesn’t download anything (seems like you are missing some bits) and wouldn’t work correctly even if you did have those bits, due to changes in the veoh service. If you’d like an example of a working (current as of 4/7/2008) script, see http://jetboystudio.com/veoh. It’s python, but you should be able to figure out how it’s messing with the network.