Heim > php教程 > php手册 > Hauptteil

php 获取优酷视频的真实地址(2014.6月新算法)

WBOY
Freigeben: 2016-07-11 20:00:44
Original
1554 Leute haben es durchsucht

  上个礼拜发现优酷改版了,各种过滤优酷广告的插件都失效了,于是我百度了一下(谷歌也不能用了)发现优酷改算法了,在ckplayer论坛发现有人在6月25号发了个php 的优酷代理文件,下载下来发现,能用但只能获取mp4格式的视频地址,而且php还加密了,没办法查看源码,后来通过微盾解密发现其中的源码,结合以前自己写的一个优酷视频解析类。。。。

感谢    3shi大大 具体分析请见 3shi大大的文章  优酷视频真实地址解析  (当然现在不能用了,主要看分析

 

ps.  新算法是从别人那里解密出来的所以有可能存在错误,当然也没有注释,不过我试了几个视频都可以解析。

 

下面是源码:

文件名为:youku.class.php

<span style="color: #008080;">  1</span> <span style="color: #000000;">php
</span><span style="color: #008080;">  2</span> 
<span style="color: #008080;">  3</span> <span style="color: #0000ff;">class</span><span style="color: #000000;"> Youku {
</span><span style="color: #008080;">  4</span> 
<span style="color: #008080;">  5</span>     <span style="color: #0000ff;">const</span> USER_AGENT = "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.116 Safari/537.36"<span style="color: #000000;">;
</span><span style="color: #008080;">  6</span>     <span style="color: #0000ff;">const</span> REFERER = "http://www.youku.com"<span style="color: #000000;">;
</span><span style="color: #008080;">  7</span>     <span style="color: #0000ff;">const</span> FORM_ENCODE = "GBK"<span style="color: #000000;">;
</span><span style="color: #008080;">  8</span>     <span style="color: #0000ff;">const</span> TO_ENCODE = "UTF-8"<span style="color: #000000;">;
</span><span style="color: #008080;">  9</span>     <span style="color: #0000ff;">private</span> <span style="color: #0000ff;">static</span> <span style="color: #800080;">$base</span> = "http://v.youku.com/player/getPlaylist/VideoIDS/"<span style="color: #000000;">;
</span><span style="color: #008080;"> 10</span>     <span style="color: #0000ff;">private</span> <span style="color: #0000ff;">static</span> <span style="color: #800080;">$source</span> = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/\\:._-1234567890"<span style="color: #000000;">;
</span><span style="color: #008080;"> 11</span>     <span style="color: #0000ff;">private</span> <span style="color: #0000ff;">static</span> <span style="color: #800080;">$sz</span> = '-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,-1,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,-1,-1,-1,-1,-1'<span style="color: #000000;">;
</span><span style="color: #008080;"> 12</span>     <span style="color: #0000ff;">private</span> <span style="color: #0000ff;">static</span> <span style="color: #800080;">$str</span> = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'<span style="color: #000000;">;
</span><span style="color: #008080;"> 13</span> 
<span style="color: #008080;"> 14</span>     <span style="color: #0000ff;">public</span> <span style="color: #0000ff;">static</span> <span style="color: #0000ff;">function</span> parse(<span style="color: #800080;">$url</span><span style="color: #000000;">){
</span><span style="color: #008080;"> 15</span>         <span style="color: #008080;">preg_match</span>("#id\_([\w=]+)#", <span style="color: #800080;">$url</span>, <span style="color: #800080;">$matches</span>); <span style="color: #008000;">//</span><span style="color: #008000;">id里可以有=号</span>
<span style="color: #008080;"> 16</span>         <span style="color: #0000ff;">if</span> (<span style="color: #0000ff;">empty</span>(<span style="color: #800080;">$matches</span><span style="color: #000000;">)){
</span><span style="color: #008080;"> 17</span>             <span style="color: #800080;">$html</span> = self::_cget(<span style="color: #800080;">$url</span><span style="color: #000000;">);
</span><span style="color: #008080;"> 18</span>             <span style="color: #008080;">preg_match</span>("#videoId2\s*=\s*\'(\w+)\'#", <span style="color: #800080;">$html</span>, <span style="color: #800080;">$matches</span><span style="color: #000000;">);
</span><span style="color: #008080;"> 19</span>             <span style="color: #0000ff;">if</span>(!<span style="color: #800080;">$matches</span>) <span style="color: #0000ff;">return</span> <span style="color: #0000ff;">false</span><span style="color: #000000;">;
</span><span style="color: #008080;"> 20</span> <span style="color: #000000;">        }
</span><span style="color: #008080;"> 21</span>         <span style="color: #008000;">//</span><span style="color: #008000;">根据you vid 获取相应的视频地址</span>
<span style="color: #008080;"> 22</span>         <span style="color: #0000ff;">return</span> self::_getYouku(<span style="color: #008080;">trim</span>(<span style="color: #800080;">$matches</span>[1<span style="color: #000000;">]));
</span><span style="color: #008080;"> 23</span> <span style="color: #000000;">    }
</span><span style="color: #008080;"> 24</span>     <span style="color: #008000;">/*</span><span style="color: #008000;">*
</span><span style="color: #008080;"> 25</span> <span style="color: #008000;">     * [_cget curl获取数据]
</span><span style="color: #008080;"> 26</span> <span style="color: #008000;">     * @param  [type]  $url     [url地址]
</span><span style="color: #008080;"> 27</span> <span style="color: #008000;">     * @param  boolean $convert [是否转换编码]
</span><span style="color: #008080;"> 28</span> <span style="color: #008000;">     * @param  integer $timeout [超时时间]
</span><span style="color: #008080;"> 29</span> <span style="color: #008000;">     * @return [type]           [description]
</span><span style="color: #008080;"> 30</span>      <span style="color: #008000;">*/</span>
<span style="color: #008080;"> 31</span>     <span style="color: #0000ff;">public</span> <span style="color: #0000ff;">static</span> <span style="color: #0000ff;">function</span> _cget(<span style="color: #800080;">$url</span>,<span style="color: #800080;">$convert</span>=<span style="color: #0000ff;">false</span>,<span style="color: #800080;">$timeout</span>=10<span style="color: #000000;">){
</span><span style="color: #008080;"> 32</span>         <span style="color: #800080;">$ch</span>=curl_init(<span style="color: #800080;">$url</span><span style="color: #000000;">);
</span><span style="color: #008080;"> 33</span>         curl_setopt(<span style="color: #800080;">$ch</span>,CURLOPT_RETURNTRANSFER,1<span style="color: #000000;">);
</span><span style="color: #008080;"> 34</span>         curl_setopt(<span style="color: #800080;">$ch</span>,CURLOPT_TIMEOUT,<span style="color: #800080;">$timeout</span><span style="color: #000000;">);
</span><span style="color: #008080;"> 35</span>         curl_setopt(<span style="color: #800080;">$ch</span>,CURLOPT_CONNECTTIMEOUT,<span style="color: #800080;">$timeout</span><span style="color: #000000;">);
</span><span style="color: #008080;"> 36</span>         curl_setopt(<span style="color: #800080;">$ch</span>,CURLOPT_USERAGENT,self::<span style="color: #000000;">USER_AGENT);
</span><span style="color: #008080;"> 37</span>         curl_setopt(<span style="color: #800080;">$ch</span>,CURLOPT_REFERER,self::<span style="color: #000000;">REFERER);       
</span><span style="color: #008080;"> 38</span>         curl_setopt(<span style="color: #800080;">$ch</span>,CURLOPT_FOLLOWLOCATION,1); <span style="color: #008000;">//</span><span style="color: #008000;">跟随301跳转</span>
<span style="color: #008080;"> 39</span>         curl_setopt(<span style="color: #800080;">$ch</span>,CURLOPT_AUTOREFERER,1); <span style="color: #008000;">//</span><span style="color: #008000;">自动设置referer              </span>
<span style="color: #008080;"> 40</span>         <span style="color: #800080;">$res</span>=curl_exec(<span style="color: #800080;">$ch</span><span style="color: #000000;">);
</span><span style="color: #008080;"> 41</span>         curl_close(<span style="color: #800080;">$ch</span><span style="color: #000000;">);
</span><span style="color: #008080;"> 42</span>         <span style="color: #0000ff;">if</span>(<span style="color: #800080;">$convert</span><span style="color: #000000;">){
</span><span style="color: #008080;"> 43</span>             <span style="color: #800080;">$res</span>=mb_convert_encoding(<span style="color: #800080;">$res</span>,self::TO_ENCODE,self::<span style="color: #000000;">FORM_ENCODE);
</span><span style="color: #008080;"> 44</span> <span style="color: #000000;">        }
</span><span style="color: #008080;"> 45</span>         <span style="color: #0000ff;">return</span> <span style="color: #800080;">$res</span><span style="color: #000000;">;
</span><span style="color: #008080;"> 46</span> <span style="color: #000000;">    }    
</span><span style="color: #008080;"> 47</span> 
<span style="color: #008080;"> 48</span>     <span style="color: #008000;">//</span><span style="color: #008000;">start 获得优酷视频需要用到的方法</span>
<span style="color: #008080;"> 49</span>     <span style="color: #0000ff;">private</span> <span style="color: #0000ff;">static</span> <span style="color: #0000ff;">function</span><span style="color: #000000;"> getSid(){
</span><span style="color: #008080;"> 50</span>         <span style="color: #800080;">$sid</span> = <span style="color: #008080;">time</span>().(<span style="color: #008080;">mt_rand</span>(0,9000)+10000<span style="color: #000000;">);
</span><span style="color: #008080;"> 51</span>         <span style="color: #0000ff;">return</span> <span style="color: #800080;">$sid</span><span style="color: #000000;">;
</span><span style="color: #008080;"> 52</span> <span style="color: #000000;">    }
</span><span style="color: #008080;"> 53</span> 
<span style="color: #008080;"> 54</span>     <span style="color: #0000ff;">private</span> <span style="color: #0000ff;">static</span> <span style="color: #0000ff;">function</span> getKey(<span style="color: #800080;">$key1</span>,<span style="color: #800080;">$key2</span><span style="color: #000000;">){
</span><span style="color: #008080;"> 55</span>         <span style="color: #800080;">$a</span> = <span style="color: #008080;">hexdec</span>(<span style="color: #800080;">$key1</span><span style="color: #000000;">);
</span><span style="color: #008080;"> 56</span>         <span style="color: #800080;">$b</span> = <span style="color: #800080;">$a</span> ^0xA55AA5A5<span style="color: #000000;">;
</span><span style="color: #008080;"> 57</span>         <span style="color: #800080;">$b</span> = <span style="color: #008080;">dechex</span>(<span style="color: #800080;">$b</span><span style="color: #000000;">);
</span><span style="color: #008080;"> 58</span>         <span style="color: #0000ff;">return</span> <span style="color: #800080;">$key2</span>.<span style="color: #800080;">$b</span><span style="color: #000000;">;
</span><span style="color: #008080;"> 59</span> <span style="color: #000000;">    }
</span><span style="color: #008080;"> 60</span> 
<span style="color: #008080;"> 61</span>     <span style="color: #0000ff;">private</span> <span style="color: #0000ff;">static</span> <span style="color: #0000ff;">function</span> getFileid(<span style="color: #800080;">$fileId</span>,<span style="color: #800080;">$seed</span><span style="color: #000000;">){
</span><span style="color: #008080;"> 62</span>         <span style="color: #800080;">$mixed</span> = self::getMixString(<span style="color: #800080;">$seed</span><span style="color: #000000;">);
</span><span style="color: #008080;"> 63</span>         <span style="color: #800080;">$ids</span> = <span style="color: #008080;">explode</span>("*",<span style="color: #008080;">rtrim</span>(<span style="color: #800080;">$fileId</span>,'*')); <span style="color: #008000;">//</span><span style="color: #008000;">去掉末尾的*号分割为数组</span>
<span style="color: #008080;"> 64</span>         <span style="color: #800080;">$realId</span> = ""<span style="color: #000000;">;
</span><span style="color: #008080;"> 65</span>         <span style="color: #0000ff;">for</span> (<span style="color: #800080;">$i</span>=0;<span style="color: #800080;">$i</span>count(<span style="color: #800080;">$ids</span>);<span style="color: #800080;">$i</span>++<span style="color: #000000;">){
</span><span style="color: #008080;"> 66</span>             <span style="color: #800080;">$idx</span> = <span style="color: #800080;">$ids</span>[<span style="color: #800080;">$i</span><span style="color: #000000;">];
</span><span style="color: #008080;"> 67</span>             <span style="color: #800080;">$realId</span> .= <span style="color: #008080;">substr</span>(<span style="color: #800080;">$mixed</span>,<span style="color: #800080;">$idx</span>,1<span style="color: #000000;">);
</span><span style="color: #008080;"> 68</span> <span style="color: #000000;">        }  
</span><span style="color: #008080;"> 69</span>         <span style="color: #0000ff;">return</span> <span style="color: #800080;">$realId</span><span style="color: #000000;">;
</span><span style="color: #008080;"> 70</span> <span style="color: #000000;">    } 
</span><span style="color: #008080;"> 71</span> 
<span style="color: #008080;"> 72</span>     <span style="color: #0000ff;">private</span> <span style="color: #0000ff;">static</span> <span style="color: #0000ff;">function</span> getMixString(<span style="color: #800080;">$seed</span><span style="color: #000000;">){
</span><span style="color: #008080;"> 73</span>         <span style="color: #800080;">$mixed</span> = ""<span style="color: #000000;">;
</span><span style="color: #008080;"> 74</span>         <span style="color: #800080;">$source</span> = self::<span style="color: #800080;">$source</span><span style="color: #000000;">;
</span><span style="color: #008080;"> 75</span>         <span style="color: #800080;">$len</span> = <span style="color: #008080;">strlen</span>(<span style="color: #800080;">$source</span><span style="color: #000000;">);
</span><span style="color: #008080;"> 76</span>         <span style="color: #0000ff;">for</span>(<span style="color: #800080;">$i</span>=0;<span style="color: #800080;">$i</span>$len;<span style="color: #800080;">$i</span>++<span style="color: #000000;">){
</span><span style="color: #008080;"> 77</span>             <span style="color: #800080;">$seed</span> = (<span style="color: #800080;">$seed</span> * 211 + 30031)%65536<span style="color: #000000;">;
</span><span style="color: #008080;"> 78</span>             <span style="color: #800080;">$index</span> = (<span style="color: #800080;">$seed</span> / 65536 * <span style="color: #008080;">strlen</span>(<span style="color: #800080;">$source</span><span style="color: #000000;">));
</span><span style="color: #008080;"> 79</span>             <span style="color: #800080;">$c</span> = <span style="color: #008080;">substr</span>(<span style="color: #800080;">$source</span>,<span style="color: #800080;">$index</span>,1<span style="color: #000000;">);
</span><span style="color: #008080;"> 80</span>             <span style="color: #800080;">$mixed</span> .= <span style="color: #800080;">$c</span><span style="color: #000000;">;
</span><span style="color: #008080;"> 81</span>             <span style="color: #800080;">$source</span> = <span style="color: #008080;">str_replace</span>(<span style="color: #800080;">$c</span>,"",<span style="color: #800080;">$source</span><span style="color: #000000;">);
</span><span style="color: #008080;"> 82</span> <span style="color: #000000;">        }
</span><span style="color: #008080;"> 83</span>         <span style="color: #0000ff;">return</span> <span style="color: #800080;">$mixed</span><span style="color: #000000;">;
</span><span style="color: #008080;"> 84</span> <span style="color: #000000;">    }
</span><span style="color: #008080;"> 85</span> 
<span style="color: #008080;"> 86</span>     <span style="color: #0000ff;">private</span> <span style="color: #0000ff;">static</span> <span style="color: #0000ff;">function</span> yk_d(<span style="color: #800080;">$a</span><span style="color: #000000;">){
</span><span style="color: #008080;"> 87</span>         <span style="color: #0000ff;">if</span> (!<span style="color: #800080;">$a</span><span style="color: #000000;">) {
</span><span style="color: #008080;"> 88</span>             <span style="color: #0000ff;">return</span> ''<span style="color: #000000;">;
</span><span style="color: #008080;"> 89</span> <span style="color: #000000;">        }
</span><span style="color: #008080;"> 90</span>         <span style="color: #800080;">$f</span> = <span style="color: #008080;">strlen</span>(<span style="color: #800080;">$a</span><span style="color: #000000;">);
</span><span style="color: #008080;"> 91</span>         <span style="color: #800080;">$b</span> = 0<span style="color: #000000;">;
</span><span style="color: #008080;"> 92</span>         <span style="color: #800080;">$str</span> = self::<span style="color: #800080;">$str</span><span style="color: #000000;">;
</span><span style="color: #008080;"> 93</span>         <span style="color: #0000ff;">for</span> (<span style="color: #800080;">$c</span> = ''; <span style="color: #800080;">$b</span> $f<span style="color: #000000;">;) {
</span><span style="color: #008080;"> 94</span>             <span style="color: #800080;">$e</span> = self::charCodeAt(<span style="color: #800080;">$a</span>, <span style="color: #800080;">$b</span>++) & 255<span style="color: #000000;">;
</span><span style="color: #008080;"> 95</span>             <span style="color: #0000ff;">if</span> (<span style="color: #800080;">$b</span> == <span style="color: #800080;">$f</span><span style="color: #000000;">) {
</span><span style="color: #008080;"> 96</span>                 <span style="color: #800080;">$c</span> .= self::charAt(<span style="color: #800080;">$str</span>, <span style="color: #800080;">$e</span> >> 2<span style="color: #000000;">);
</span><span style="color: #008080;"> 97</span>                 <span style="color: #800080;">$c</span> .= self::charAt(<span style="color: #800080;">$str</span>, (<span style="color: #800080;">$e</span> & 3) );
<span style="color: #008080;"> 98</span>                 <span style="color: #800080;">$c</span> .= '=='<span style="color: #000000;">;
</span><span style="color: #008080;"> 99</span>                 <span style="color: #0000ff;">break</span><span style="color: #000000;">;
</span><span style="color: #008080;">100</span> <span style="color: #000000;">            }
</span><span style="color: #008080;">101</span>             <span style="color: #800080;">$g</span> = self::charCodeAt(<span style="color: #800080;">$a</span>, <span style="color: #800080;">$b</span>++<span style="color: #000000;">);
</span><span style="color: #008080;">102</span>             <span style="color: #0000ff;">if</span> (<span style="color: #800080;">$b</span> == <span style="color: #800080;">$f</span><span style="color: #000000;">) {
</span><span style="color: #008080;">103</span>                 <span style="color: #800080;">$c</span> .= self::charAt(<span style="color: #800080;">$str</span>, <span style="color: #800080;">$e</span> >> 2<span style="color: #000000;">);
</span><span style="color: #008080;">104</span>                 <span style="color: #800080;">$c</span> .= self::charAt(<span style="color: #800080;">$str</span>, (<span style="color: #800080;">$e</span> & 3) $g & 240) >> 4<span style="color: #000000;">);
</span><span style="color: #008080;">105</span>                 <span style="color: #800080;">$c</span> .= self::charAt(<span style="color: #800080;">$str</span>, (<span style="color: #800080;">$g</span> & 15) );
<span style="color: #008080;">106</span>                 <span style="color: #800080;">$c</span> .= '='<span style="color: #000000;">;
</span><span style="color: #008080;">107</span>                 <span style="color: #0000ff;">break</span><span style="color: #000000;">;
</span><span style="color: #008080;">108</span> <span style="color: #000000;">            }
</span><span style="color: #008080;">109</span>             <span style="color: #800080;">$h</span> = self::charCodeAt(<span style="color: #800080;">$a</span>, <span style="color: #800080;">$b</span>++<span style="color: #000000;">);
</span><span style="color: #008080;">110</span>             <span style="color: #800080;">$c</span> .= self::charAt(<span style="color: #800080;">$str</span>, <span style="color: #800080;">$e</span> >> 2<span style="color: #000000;">);
</span><span style="color: #008080;">111</span>             <span style="color: #800080;">$c</span> .= self::charAt(<span style="color: #800080;">$str</span>, (<span style="color: #800080;">$e</span> & 3) $g & 240) >> 4<span style="color: #000000;">);
</span><span style="color: #008080;">112</span>             <span style="color: #800080;">$c</span> .= self::charAt(<span style="color: #800080;">$str</span>, (<span style="color: #800080;">$g</span> & 15) $h & 192) >> 6<span style="color: #000000;">);
</span><span style="color: #008080;">113</span>             <span style="color: #800080;">$c</span> .= self::charAt(<span style="color: #800080;">$str</span>, <span style="color: #800080;">$h</span> & 63<span style="color: #000000;">);
</span><span style="color: #008080;">114</span> <span style="color: #000000;">        }
</span><span style="color: #008080;">115</span>         <span style="color: #0000ff;">return</span> <span style="color: #800080;">$c</span><span style="color: #000000;">;
</span><span style="color: #008080;">116</span> <span style="color: #000000;">    }
</span><span style="color: #008080;">117</span>     <span style="color: #0000ff;">private</span> <span style="color: #0000ff;">static</span> <span style="color: #0000ff;">function</span> yk_na(<span style="color: #800080;">$a</span><span style="color: #000000;">){
</span><span style="color: #008080;">118</span>         <span style="color: #0000ff;">if</span> (!<span style="color: #800080;">$a</span><span style="color: #000000;">) {
</span><span style="color: #008080;">119</span>             <span style="color: #0000ff;">return</span> ''<span style="color: #000000;">;
</span><span style="color: #008080;">120</span> <span style="color: #000000;">        }
</span><span style="color: #008080;">121</span> 
<span style="color: #008080;">122</span>         <span style="color: #800080;">$h</span> = <span style="color: #008080;">explode</span>(',', self::<span style="color: #800080;">$sz</span><span style="color: #000000;">);
</span><span style="color: #008080;">123</span>         <span style="color: #800080;">$i</span> = <span style="color: #008080;">strlen</span>(<span style="color: #800080;">$a</span><span style="color: #000000;">);
</span><span style="color: #008080;">124</span>         <span style="color: #800080;">$f</span> = 0<span style="color: #000000;">;
</span><span style="color: #008080;">125</span>         <span style="color: #0000ff;">for</span> (<span style="color: #800080;">$e</span> = ''; <span style="color: #800080;">$f</span> $i<span style="color: #000000;">;) {
</span><span style="color: #008080;">126</span>             <span style="color: #0000ff;">do</span><span style="color: #000000;"> {
</span><span style="color: #008080;">127</span>                 <span style="color: #800080;">$c</span> = <span style="color: #800080;">$h</span>[self::charCodeAt(<span style="color: #800080;">$a</span>, <span style="color: #800080;">$f</span>++) & 255<span style="color: #000000;">];
</span><span style="color: #008080;">128</span>             } <span style="color: #0000ff;">while</span> (<span style="color: #800080;">$f</span> $i && -1 == <span style="color: #800080;">$c</span><span style="color: #000000;">);
</span><span style="color: #008080;">129</span>             <span style="color: #0000ff;">if</span> (-1 == <span style="color: #800080;">$c</span><span style="color: #000000;">) {
</span><span style="color: #008080;">130</span>                 <span style="color: #0000ff;">break</span><span style="color: #000000;">;
</span><span style="color: #008080;">131</span> <span style="color: #000000;">            }
</span><span style="color: #008080;">132</span>             <span style="color: #0000ff;">do</span><span style="color: #000000;"> {
</span><span style="color: #008080;">133</span>                 <span style="color: #800080;">$b</span> = <span style="color: #800080;">$h</span>[self::charCodeAt(<span style="color: #800080;">$a</span>, <span style="color: #800080;">$f</span>++) & 255<span style="color: #000000;">];
</span><span style="color: #008080;">134</span>             } <span style="color: #0000ff;">while</span> (<span style="color: #800080;">$f</span> $i && -1 == <span style="color: #800080;">$b</span><span style="color: #000000;">);
</span><span style="color: #008080;">135</span>             <span style="color: #0000ff;">if</span> (-1 == <span style="color: #800080;">$b</span><span style="color: #000000;">) {
</span><span style="color: #008080;">136</span>                 <span style="color: #0000ff;">break</span><span style="color: #000000;">;
</span><span style="color: #008080;">137</span> <span style="color: #000000;">            }
</span><span style="color: #008080;">138</span>             <span style="color: #800080;">$e</span> .= self::fromCharCode(<span style="color: #800080;">$c</span> $b & 48) >> 4<span style="color: #000000;">);
</span><span style="color: #008080;">139</span>             <span style="color: #0000ff;">do</span><span style="color: #000000;"> {
</span><span style="color: #008080;">140</span>                 <span style="color: #800080;">$c</span> = self::charCodeAt(<span style="color: #800080;">$a</span>, <span style="color: #800080;">$f</span>++) & 255<span style="color: #000000;">;
</span><span style="color: #008080;">141</span>                 <span style="color: #0000ff;">if</span> (61 == <span style="color: #800080;">$c</span><span style="color: #000000;">) {
</span><span style="color: #008080;">142</span>                     <span style="color: #0000ff;">return</span> <span style="color: #800080;">$e</span><span style="color: #000000;">;
</span><span style="color: #008080;">143</span> <span style="color: #000000;">                }
</span><span style="color: #008080;">144</span>                 <span style="color: #800080;">$c</span> = <span style="color: #800080;">$h</span>[<span style="color: #800080;">$c</span><span style="color: #000000;">];
</span><span style="color: #008080;">145</span>             } <span style="color: #0000ff;">while</span> (<span style="color: #800080;">$f</span> $i && -1 == <span style="color: #800080;">$c</span><span style="color: #000000;">);
</span><span style="color: #008080;">146</span>             <span style="color: #0000ff;">if</span> (-1 == <span style="color: #800080;">$c</span><span style="color: #000000;">) {
</span><span style="color: #008080;">147</span>                 <span style="color: #0000ff;">break</span><span style="color: #000000;">;
</span><span style="color: #008080;">148</span> <span style="color: #000000;">            }
</span><span style="color: #008080;">149</span>             <span style="color: #800080;">$e</span> .= self::fromCharCode((<span style="color: #800080;">$b</span> & 15) $c & 60) >> 2<span style="color: #000000;">);
</span><span style="color: #008080;">150</span>             <span style="color: #0000ff;">do</span><span style="color: #000000;"> {
</span><span style="color: #008080;">151</span>                 <span style="color: #800080;">$b</span> = self::charCodeAt(<span style="color: #800080;">$a</span>, <span style="color: #800080;">$f</span>++) & 255<span style="color: #000000;">;
</span><span style="color: #008080;">152</span>                 <span style="color: #0000ff;">if</span> (61 == <span style="color: #800080;">$b</span><span style="color: #000000;">) {
</span><span style="color: #008080;">153</span>                     <span style="color: #0000ff;">return</span> <span style="color: #800080;">$e</span><span style="color: #000000;">;
</span><span style="color: #008080;">154</span> <span style="color: #000000;">                }
</span><span style="color: #008080;">155</span>                 <span style="color: #800080;">$b</span> = <span style="color: #800080;">$h</span>[<span style="color: #800080;">$b</span><span style="color: #000000;">];
</span><span style="color: #008080;">156</span>             } <span style="color: #0000ff;">while</span> (<span style="color: #800080;">$f</span> $i && -1 == <span style="color: #800080;">$b</span><span style="color: #000000;">);
</span><span style="color: #008080;">157</span>             <span style="color: #0000ff;">if</span> (-1 == <span style="color: #800080;">$b</span><span style="color: #000000;">) {
</span><span style="color: #008080;">158</span>                 <span style="color: #0000ff;">break</span><span style="color: #000000;">;
</span><span style="color: #008080;">159</span> <span style="color: #000000;">            }
</span><span style="color: #008080;">160</span>             <span style="color: #800080;">$e</span> .= self::fromCharCode((<span style="color: #800080;">$c</span> & 3) $b<span style="color: #000000;">);
</span><span style="color: #008080;">161</span> <span style="color: #000000;">        }
</span><span style="color: #008080;">162</span>         <span style="color: #0000ff;">return</span> <span style="color: #800080;">$e</span><span style="color: #000000;">;
</span><span style="color: #008080;">163</span> <span style="color: #000000;">    }
</span><span style="color: #008080;">164</span>     <span style="color: #0000ff;">private</span> <span style="color: #0000ff;">static</span> <span style="color: #0000ff;">function</span> yk_e(<span style="color: #800080;">$a</span>, <span style="color: #800080;">$c</span><span style="color: #000000;">){
</span><span style="color: #008080;">165</span>         <span style="color: #0000ff;">for</span> (<span style="color: #800080;">$f</span> = 0, <span style="color: #800080;">$i</span>, <span style="color: #800080;">$e</span> = '', <span style="color: #800080;">$h</span> = 0; 256 > <span style="color: #800080;">$h</span>; <span style="color: #800080;">$h</span>++<span style="color: #000000;">) {
</span><span style="color: #008080;">166</span>             <span style="color: #800080;">$b</span>[<span style="color: #800080;">$h</span>] = <span style="color: #800080;">$h</span><span style="color: #000000;">;
</span><span style="color: #008080;">167</span> <span style="color: #000000;">        }
</span><span style="color: #008080;">168</span>         <span style="color: #0000ff;">for</span> (<span style="color: #800080;">$h</span> = 0; 256 > <span style="color: #800080;">$h</span>; <span style="color: #800080;">$h</span>++<span style="color: #000000;">) {
</span><span style="color: #008080;">169</span>             <span style="color: #800080;">$f</span> = ((<span style="color: #800080;">$f</span> + <span style="color: #800080;">$b</span>[<span style="color: #800080;">$h</span>]) + self::charCodeAt(<span style="color: #800080;">$a</span>, <span style="color: #800080;">$h</span> % <span style="color: #008080;">strlen</span>(<span style="color: #800080;">$a</span>))) % 256<span style="color: #000000;">;
</span><span style="color: #008080;">170</span>             <span style="color: #800080;">$i</span> = <span style="color: #800080;">$b</span>[<span style="color: #800080;">$h</span><span style="color: #000000;">];
</span><span style="color: #008080;">171</span>             <span style="color: #800080;">$b</span>[<span style="color: #800080;">$h</span>] = <span style="color: #800080;">$b</span>[<span style="color: #800080;">$f</span><span style="color: #000000;">];
</span><span style="color: #008080;">172</span>             <span style="color: #800080;">$b</span>[<span style="color: #800080;">$f</span>] = <span style="color: #800080;">$i</span><span style="color: #000000;">;
</span><span style="color: #008080;">173</span> <span style="color: #000000;">        }
</span><span style="color: #008080;">174</span>         <span style="color: #0000ff;">for</span> (<span style="color: #800080;">$q</span> = (<span style="color: #800080;">$f</span> = (<span style="color: #800080;">$h</span> = 0)); <span style="color: #800080;">$q</span> strlen(<span style="color: #800080;">$c</span>); <span style="color: #800080;">$q</span>++<span style="color: #000000;">) {
</span><span style="color: #008080;">175</span>             <span style="color: #800080;">$h</span> = (<span style="color: #800080;">$h</span> + 1) % 256<span style="color: #000000;">;
</span><span style="color: #008080;">176</span>             <span style="color: #800080;">$f</span> = (<span style="color: #800080;">$f</span> + <span style="color: #800080;">$b</span>[<span style="color: #800080;">$h</span>]) % 256<span style="color: #000000;">;
</span><span style="color: #008080;">177</span>             <span style="color: #800080;">$i</span> = <span style="color: #800080;">$b</span>[<span style="color: #800080;">$h</span><span style="color: #000000;">];
</span><span style="color: #008080;">178</span>             <span style="color: #800080;">$b</span>[<span style="color: #800080;">$h</span>] = <span style="color: #800080;">$b</span>[<span style="color: #800080;">$f</span><span style="color: #000000;">];
</span><span style="color: #008080;">179</span>             <span style="color: #800080;">$b</span>[<span style="color: #800080;">$f</span>] = <span style="color: #800080;">$i</span><span style="color: #000000;">;
</span><span style="color: #008080;">180</span>             <span style="color: #800080;">$e</span> .= self::fromCharCode(self::charCodeAt(<span style="color: #800080;">$c</span>, <span style="color: #800080;">$q</span>) ^ <span style="color: #800080;">$b</span>[(<span style="color: #800080;">$b</span>[<span style="color: #800080;">$h</span>] + <span style="color: #800080;">$b</span>[<span style="color: #800080;">$f</span>]) % 256<span style="color: #000000;">]);
</span><span style="color: #008080;">181</span> <span style="color: #000000;">        }
</span><span style="color: #008080;">182</span>         <span style="color: #0000ff;">return</span> <span style="color: #800080;">$e</span><span style="color: #000000;">;
</span><span style="color: #008080;">183</span> <span style="color: #000000;">    }
</span><span style="color: #008080;">184</span>     
<span style="color: #008080;">185</span>     <span style="color: #0000ff;">private</span> <span style="color: #0000ff;">static</span> <span style="color: #0000ff;">function</span> fromCharCode(<span style="color: #800080;">$codes</span><span style="color: #000000;">){
</span><span style="color: #008080;">186</span>         <span style="color: #0000ff;">if</span> (<span style="color: #008080;">is_scalar</span>(<span style="color: #800080;">$codes</span><span style="color: #000000;">)) {
</span><span style="color: #008080;">187</span>             <span style="color: #800080;">$codes</span> = <span style="color: #008080;">func_get_args</span><span style="color: #000000;">();
</span><span style="color: #008080;">188</span> <span style="color: #000000;">        }
</span><span style="color: #008080;">189</span>         <span style="color: #800080;">$str</span> = ''<span style="color: #000000;">;
</span><span style="color: #008080;">190</span>         <span style="color: #0000ff;">foreach</span> (<span style="color: #800080;">$codes</span> <span style="color: #0000ff;">as</span> <span style="color: #800080;">$code</span><span style="color: #000000;">) {
</span><span style="color: #008080;">191</span>             <span style="color: #800080;">$str</span> .= <span style="color: #008080;">chr</span>(<span style="color: #800080;">$code</span><span style="color: #000000;">);
</span><span style="color: #008080;">192</span> <span style="color: #000000;">        }
</span><span style="color: #008080;">193</span>         <span style="color: #0000ff;">return</span> <span style="color: #800080;">$str</span><span style="color: #000000;">;
</span><span style="color: #008080;">194</span> <span style="color: #000000;">    }
</span><span style="color: #008080;">195</span>     <span style="color: #0000ff;">private</span> <span style="color: #0000ff;">static</span> <span style="color: #0000ff;">function</span> charCodeAt(<span style="color: #800080;">$str</span>, <span style="color: #800080;">$index</span><span style="color: #000000;">){
</span><span style="color: #008080;">196</span>         <span style="color: #0000ff;">static</span> <span style="color: #800080;">$charCode</span> = <span style="color: #0000ff;">array</span><span style="color: #000000;">();
</span><span style="color: #008080;">197</span>         <span style="color: #800080;">$key</span> = <span style="color: #008080;">md5</span>(<span style="color: #800080;">$str</span><span style="color: #000000;">);
</span><span style="color: #008080;">198</span>         <span style="color: #800080;">$index</span> = <span style="color: #800080;">$index</span> + 1<span style="color: #000000;">;
</span><span style="color: #008080;">199</span>         <span style="color: #0000ff;">if</span> (<span style="color: #0000ff;">isset</span>(<span style="color: #800080;">$charCode</span>[<span style="color: #800080;">$key</span><span style="color: #000000;">])) {
</span><span style="color: #008080;">200</span>             <span style="color: #0000ff;">return</span> <span style="color: #800080;">$charCode</span>[<span style="color: #800080;">$key</span>][<span style="color: #800080;">$index</span><span style="color: #000000;">];
</span><span style="color: #008080;">201</span> <span style="color: #000000;">        }
</span><span style="color: #008080;">202</span>         <span style="color: #800080;">$charCode</span>[<span style="color: #800080;">$key</span>] = <span style="color: #008080;">unpack</span>('C*', <span style="color: #800080;">$str</span><span style="color: #000000;">);
</span><span style="color: #008080;">203</span>         <span style="color: #0000ff;">return</span> <span style="color: #800080;">$charCode</span>[<span style="color: #800080;">$key</span>][<span style="color: #800080;">$index</span><span style="color: #000000;">];
</span><span style="color: #008080;">204</span> <span style="color: #000000;">    }
</span><span style="color: #008080;">205</span> 
<span style="color: #008080;">206</span>     <span style="color: #0000ff;">private</span> <span style="color: #0000ff;">static</span> <span style="color: #0000ff;">function</span> charAt(<span style="color: #800080;">$str</span>, <span style="color: #800080;">$index</span> = 0<span style="color: #000000;">){
</span><span style="color: #008080;">207</span>         <span style="color: #0000ff;">return</span> <span style="color: #008080;">substr</span>(<span style="color: #800080;">$str</span>, <span style="color: #800080;">$index</span>, 1<span style="color: #000000;">);
</span><span style="color: #008080;">208</span> <span style="color: #000000;">    }
</span><span style="color: #008080;">209</span> 
<span style="color: #008080;">210</span> 
<span style="color: #008080;">211</span>     <span style="color: #008000;">/*</span><span style="color: #008000;">*
</span><span style="color: #008080;">212</span> <span style="color: #008000;">     * [_getYouku description]
</span><span style="color: #008080;">213</span> <span style="color: #008000;">     * @param  [type] $vid [视频id]
</span><span style="color: #008080;">214</span> <span style="color: #008000;">     * @return [type]      [description]
</span><span style="color: #008080;">215</span>      <span style="color: #008000;">*/</span>
<span style="color: #008080;">216</span>     <span style="color: #0000ff;">public</span> <span style="color: #0000ff;">static</span> <span style="color: #0000ff;">function</span> _getYouku(<span style="color: #800080;">$vid</span><span style="color: #000000;">){
</span><span style="color: #008080;">217</span>         <span style="color: #008000;">//</span><span style="color: #008000;">$link = "http://v.youku.com/player/getPlayList/VideoIDS/{$vid}/Pf/4"; //获取视频信息json 有些视频获取不全(土豆网的 火影忍者)</span>
<span style="color: #008080;">218</span>         <span style="color: #800080;">$blink</span> = self::<span style="color: #800080;">$base</span>.<span style="color: #800080;">$vid</span><span style="color: #000000;">;
</span><span style="color: #008080;">219</span>         <span style="color: #800080;">$link</span> = <span style="color: #800080;">$blink</span>."/Pf/4/ctype/12/ev/1"<span style="color: #000000;">;
</span><span style="color: #008080;">220</span>         <span style="color: #800080;">$retval</span> = self::_cget(<span style="color: #800080;">$link</span><span style="color: #000000;">);
</span><span style="color: #008080;">221</span>         <span style="color: #800080;">$bretval</span> = self::_cget(<span style="color: #800080;">$blink</span><span style="color: #000000;">);
</span><span style="color: #008080;">222</span>         <span style="color: #0000ff;">if</span> (<span style="color: #800080;">$retval</span><span style="color: #000000;">) {
</span><span style="color: #008080;">223</span>             <span style="color: #800080;">$rs</span> = json_decode(<span style="color: #800080;">$retval</span>, <span style="color: #0000ff;">true</span><span style="color: #000000;">);
</span><span style="color: #008080;">224</span>             <span style="color: #800080;">$brs</span> = json_decode(<span style="color: #800080;">$bretval</span>, <span style="color: #0000ff;">true</span><span style="color: #000000;">);
</span><span style="color: #008080;">225</span>             <span style="color: #0000ff;">if</span>(!<span style="color: #0000ff;">empty</span>(<span style="color: #800080;">$rs</span>['data'][0]['error'<span style="color: #000000;">])){
</span><span style="color: #008080;">226</span>                 <span style="color: #0000ff;">return</span> <span style="color: #0000ff;">false</span>;  <span style="color: #008000;">//</span><span style="color: #008000;">有错误返回false</span>
<span style="color: #008080;">227</span> <span style="color: #000000;">            }
</span><span style="color: #008080;">228</span>             <span style="color: #800080;">$data</span> = <span style="color: #0000ff;">array</span><span style="color: #000000;">();
</span><span style="color: #008080;">229</span>             <span style="color: #800080;">$streamtypes</span> = <span style="color: #800080;">$rs</span>['data'][0]['streamtypes'];  <span style="color: #008000;">//</span><span style="color: #008000;">可以输出的视频清晰度</span>
<span style="color: #008080;">230</span>             <span style="color: #800080;">$streamfileids</span> = <span style="color: #800080;">$rs</span>['data'][0]['streamfileids'<span style="color: #000000;">];
</span><span style="color: #008080;">231</span>             <span style="color: #800080;">$seed</span> = <span style="color: #800080;">$rs</span>['data'][0]['seed'<span style="color: #000000;">];
</span><span style="color: #008080;">232</span>             <span style="color: #800080;">$segs</span> = <span style="color: #800080;">$rs</span>['data'][0]['segs'<span style="color: #000000;">];
</span><span style="color: #008080;">233</span>             <span style="color: #800080;">$ip</span> = <span style="color: #800080;">$rs</span>['data'][0]['ip'<span style="color: #000000;">];
</span><span style="color: #008080;">234</span>             <span style="color: #800080;">$bsegs</span> =  <span style="color: #800080;">$brs</span>['data'][0]['segs'<span style="color: #000000;">];
</span><span style="color: #008080;">235</span>             <span style="color: #0000ff;">list</span>(<span style="color: #800080;">$sid</span>, <span style="color: #800080;">$token</span>) = <span style="color: #008080;">explode</span>('_', self::yk_e('becaf9be', self::yk_na(<span style="color: #800080;">$rs</span>['data'][0]['ep'<span style="color: #000000;">])));
</span><span style="color: #008080;">236</span>             <span style="color: #0000ff;">foreach</span> (<span style="color: #800080;">$segs</span> <span style="color: #0000ff;">as</span> <span style="color: #800080;">$key</span>=><span style="color: #800080;">$val</span><span style="color: #000000;">) {
</span><span style="color: #008080;">237</span>                 <span style="color: #0000ff;">if</span>(<span style="color: #008080;">in_array</span>(<span style="color: #800080;">$key</span>,<span style="color: #800080;">$streamtypes</span><span style="color: #000000;">)){
</span><span style="color: #008080;">238</span>                     <span style="color: #0000ff;">foreach</span>(<span style="color: #800080;">$val</span> <span style="color: #0000ff;">as</span> <span style="color: #800080;">$k</span>=> <span style="color: #800080;">$v</span><span style="color: #000000;">){
</span><span style="color: #008080;">239</span>                         <span style="color: #800080;">$no</span> = <span style="color: #008080;">strtoupper</span>(<span style="color: #008080;">dechex</span>(<span style="color: #800080;">$v</span>['no'])); <span style="color: #008000;">//</span><span style="color: #008000;">转换为16进制 大写</span>
<span style="color: #008080;">240</span>                         <span style="color: #0000ff;">if</span>(<span style="color: #008080;">strlen</span>(<span style="color: #800080;">$no</span>) == 1<span style="color: #000000;">){
</span><span style="color: #008080;">241</span>                             <span style="color: #800080;">$no</span> ="0".<span style="color: #800080;">$no</span>;  <span style="color: #008000;">//</span><span style="color: #008000;">no 为每段视频序号</span>
<span style="color: #008080;">242</span> <span style="color: #000000;">                        }
</span><span style="color: #008080;">243</span>                         <span style="color: #008000;">//</span><span style="color: #008000;">构建视频地址K值</span>
<span style="color: #008080;">244</span>                         <span style="color: #800080;">$_k</span> = <span style="color: #800080;">$v</span>['k'<span style="color: #000000;">];
</span><span style="color: #008080;">245</span>                         <span style="color: #0000ff;">if</span> ((!<span style="color: #800080;">$_k</span> || <span style="color: #800080;">$_k</span> == '') || <span style="color: #800080;">$_k</span> == '-1'<span style="color: #000000;">) {
</span><span style="color: #008080;">246</span>                             <span style="color: #800080;">$_k</span> = <span style="color: #800080;">$bsegs</span>[<span style="color: #800080;">$key</span>][<span style="color: #800080;">$k</span>]['k'<span style="color: #000000;">];
</span><span style="color: #008080;">247</span> <span style="color: #000000;">                        }
</span><span style="color: #008080;">248</span>                         <span style="color: #800080;">$fileId</span> = self::getFileid(<span style="color: #800080;">$streamfileids</span>[<span style="color: #800080;">$key</span>],<span style="color: #800080;">$seed</span><span style="color: #000000;">);
</span><span style="color: #008080;">249</span>                         <span style="color: #800080;">$fileId</span> = <span style="color: #008080;">substr</span>(<span style="color: #800080;">$fileId</span>,0,8).<span style="color: #800080;">$no</span>.<span style="color: #008080;">substr</span>(<span style="color: #800080;">$fileId</span>,10<span style="color: #000000;">);
</span><span style="color: #008080;">250</span>                         <span style="color: #800080;">$ep</span> = <span style="color: #008080;">urlencode</span>(<span style="color: #008080;">iconv</span>('gbk', 'UTF-8', self::yk_d(self::yk_e('bf7e5f01', (((<span style="color: #800080;">$sid</span> . '_') . <span style="color: #800080;">$fileId</span>) . '_') . <span style="color: #800080;">$token</span><span style="color: #000000;">))));
</span><span style="color: #008080;">251</span>                         <span style="color: #008000;">//</span><span style="color: #008000;">判断后缀类型 、获得后缀</span>
<span style="color: #008080;">252</span>                         <span style="color: #800080;">$typeArray</span> = <span style="color: #0000ff;">array</span>("flv"=>"flv","mp4"=>"mp4","hd2"=>"flv","3gphd"=>"mp4","3gp"=>"flv","hd3"=>"flv"<span style="color: #000000;">);
</span><span style="color: #008080;">253</span>                         <span style="color: #008000;">//</span><span style="color: #008000;">判断视频清晰度  </span>
<span style="color: #008080;">254</span>                         <span style="color: #800080;">$sharpness</span> = <span style="color: #0000ff;">array</span>("flv"=>"normal","flvhd"=>"normal","mp4"=>"high","hd2"=>"super","3gphd"=>"high","3gp"=>"normal","hd3"=>"original"); <span style="color: #008000;">//</span><span style="color: #008000;">清晰度 数组</span>
<span style="color: #008080;">255</span>                         <span style="color: #800080;">$fileType</span> = <span style="color: #800080;">$typeArray</span>[<span style="color: #800080;">$key</span><span style="color: #000000;">];
</span><span style="color: #008080;">256</span>                         <span style="color: #800080;">$data</span>[<span style="color: #800080;">$sharpness</span>[<span style="color: #800080;">$key</span>]][<span style="color: #800080;">$k</span>] = "http://k.youku.com/player/getFlvPath/sid/".<span style="color: #800080;">$sid</span>."_00/st/{<span style="color: #800080;">$fileType</span>}/fileid/".<span style="color: #800080;">$fileId</span>."?K=".<span style="color: #800080;">$_k</span>."&hd=1&myp=0&ts=".(((((<span style="color: #800080;">$v</span>['seconds'].'&ypp=0&ctype=12&ev=1&token=').<span style="color: #800080;">$token</span>).'&oip=').<span style="color: #800080;">$ip</span>).'&ep=').<span style="color: #800080;">$ep</span><span style="color: #000000;">;;
</span><span style="color: #008080;">257</span> <span style="color: #000000;">                    }
</span><span style="color: #008080;">258</span> <span style="color: #000000;">                }
</span><span style="color: #008080;">259</span> <span style="color: #000000;">            }
</span><span style="color: #008080;">260</span>             <span style="color: #008000;">//</span><span style="color: #008000;">返回 图片 标题 链接  时长  视频地址</span>
<span style="color: #008080;">261</span>             <span style="color: #800080;">$data</span>['img'] = <span style="color: #800080;">$rs</span>['data'][0]['logo'<span style="color: #000000;">];
</span><span style="color: #008080;">262</span>             <span style="color: #800080;">$data</span>['title'] = <span style="color: #800080;">$rs</span>['data'][0]['title'<span style="color: #000000;">];
</span><span style="color: #008080;">263</span>             <span style="color: #800080;">$data</span>['seconds'] = <span style="color: #800080;">$rs</span>['data'][0]['seconds'<span style="color: #000000;">];
</span><span style="color: #008080;">264</span>             <span style="color: #0000ff;">return</span> <span style="color: #800080;">$data</span><span style="color: #000000;">;
</span><span style="color: #008080;">265</span>         } <span style="color: #0000ff;">else</span><span style="color: #000000;"> {
</span><span style="color: #008080;">266</span>             <span style="color: #0000ff;">return</span> <span style="color: #0000ff;">false</span><span style="color: #000000;">;
</span><span style="color: #008080;">267</span> <span style="color: #000000;">        }
</span><span style="color: #008080;">268</span> <span style="color: #000000;">    }
</span><span style="color: #008080;">269</span>     <span style="color: #008000;">//</span><span style="color: #008000;">end  获得优酷视频需要用到的方法</span>
<span style="color: #008080;">270</span> }
Nach dem Login kopieren

引入这个类就可以使用: 输出一个带有各种清晰度的 视频url 的数组。

<span style="color: #008080;">1</span> <span style="color: #0000ff;">require</span> "youku.class.php"<span style="color: #000000;">;
</span><span style="color: #008080;">2</span> <span style="color: #800080;">$url</span> = "http://v.youku.com/v_show/id_XNzM1NjQ0Mzgw.html"<span style="color: #000000;">;
</span><span style="color: #008080;">3</span> <span style="color: #800080;">$data</span> = Youku::parse(<span style="color: #800080;">$url</span><span style="color: #000000;">);
</span><span style="color: #008080;">4</span> <span style="color: #008080;">print_r</span>(<span style="color: #800080;">$data</span>);
Nach dem Login kopieren
Quelle:php.cn
Erklärung dieser Website
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn
Beliebte Empfehlungen
Beliebte Tutorials
Mehr>
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage