Get Youku Video final address _php tutorial

Source: Internet
Author: User
 Data[0]->streamfileids) {self:: $error = "Cannot find this video"; return false;} foreach ($data->data[0]->streamfileids as $k = + $v) {if ($k = = ' flv ' | | $k = = ' mp4 ') {//sid$sid=self::getsid ();// Fileid$fileid=self::getfileid ($v, $data->data[0]->seed), $one = ($data->data[0]->segs-> $k); self::$ result[$k]= "http://f.youku.com/player/getflvpath/sid/{$sid}_00/st/{$k}/fileid/{$fileid}? k={$one [0]->k} ";}} if (Empty (self:: $result)) {self:: $error = ' This viod is not ' in MP4 OR FLV FORMAT; return false;} Else{return true;}} static public Function error () {return self:: $error;} static public Function result () {return self:: $result;} Static Private Function Getyoukuid ($url) {//url cannot be empty if ($url = = "" | | substr ($url, 0,)! = "Http://v.youku.com/v_show/id_") {self:: $error = ' url is error '; return false;} Return substr ($url, 29,-5);} Static Private Function Get_curl_contents ($url, $second = 5) {if (!function_exists (' Curl_init ')) die (' PHP.ini not open php_ Curl.dll '); $c = Curl_init (); curl_setopt ($c, Curlopt_url, $url); $UserAgent =$_server[' http_user_agent '];curl_setopt ($c, curlopt_useragent, $UserAgent); curl_setopt ($c, curlopt_header,0); curl_setopt ($c, Curlopt_timeout, $second); curl_setopt ($c, Curlopt_returntransfer, true); $cnt = Curl_exec ($c); Curl_close ($c); return $cnt;} Static Private Function GetSID () {$sid = time (). ( Rand (0,9000) +10000); return $sid;} Static Private Function Getfileid ($fileId, $seed) {$mixed = self::getmixstring ($seed); $ids = Explode ("*", $fileId); unset ($ids [Count ($ids)-1]); $realId = ""; for ($i =0; $i < count ($ids); + + $i) {$idx = $ids [$i]; $realId. = substr ($mixed, $IDX, 1) ;} return $realId;} Static Private Function getmixstring ($seed) {$mixed = ""; $source = " abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz/\\:._-1234567890 "; $len = strlen ($source); for ($i =0; $i < $ len;++ $i) {$seed = ($seed * 211 + 30031)% 65536; $index = ($seed/65536 * strlen ($source)); $c = substr ($source, $index, 1); $ Mixed. = $c; $source = Str_replace ($c, "", $source);} return $mixed;}} if (youkuflv::getyoukuflv ("Http://v.yOuku.com/v_show/id_xnjeyote4ntey_ev_1.html ")) {Print_r (Youkuflv::result ());} Else{echo youkuflv::error ();}? >

There's another way.

http://player.youku.com/player.php/sid/XMjI0MDIwNDc2/v.swf

http://player.youku.com/player.php/sid/{$id}/v.swf

http://www.bkjia.com/PHPjc/440119.html www.bkjia.com true http://www.bkjia.com/PHPjc/440119.html techarticle phpclass youkuflv{static Private $error = "", Static private $result =array (), static public function getyoukuflv ($url {//Get youkuidif from URL (! $id =self::getyoukuid ($url)) {return FAL ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.