Baidu online storage video resolution, get the real source address, video resolution
Recently, we are studying video resolution for Baidu online storage to find the real source address of the online storage video. Baidu online storage needs to be downloaded from the online storage client for files exceeding 1 GB. Through packet capture research, the source video can be downloaded through the following four channels:I. https://pan.baidu.com/s/video addressThis is the shared video address.
Find the video source resolution address: interface address: Dead (fixed write) uk, path, sign, timestamp, and consumer ID can be collected in the source code. The video type and resolution format are m3u8. Note: Sometimes a verification code is displayed, therefore, it is difficult to perform automated parsing of programs, and the rate of shared videos will be limited. If malicious apps are found, Baidu may block the sharing address;
2. https://pan.baidu.com/play/video?video/path=video addressThis is an unshared video address. You can also find the video source resolution address through the PC Network Disk capture interface: interface address: the signature sign must be obtained after sign3 and sign1 (sign3 and sign1 are collected in the source code of the page), and obtained through the sign2 encryption algorithm and base64. the php implementation algorithm of sign is given below:
function s($j,$r)
{ $a = array(); $p = array(); $o = ""; $v = strlen($j); $j = str_split($j,1); for($q=0;$q<256;$q++)
{ $a[$q] = charCodeAt($j[$q%$v]); $p[$q]=$q; }
for($u=$q=0;$q<256;$q++)
{ $u=($u+$p[$q]+$a[$q])%256; $t=$p[$q]; $p[$q]=$p[$u]; $p[$u]=$t; }
for($i=$u=$q=0;$q<strlen($r);$q++)
{ $i=($i+1)%256; $u=($u+$p[$i])%256; $t=$p[$i]; $p[$i]=$p[$u]; $p[$u]=$t; $k=$p[(($p[$i]+$p[$u])%256)]; $r2 = str_split($r,1); $o.=fromCharCode(charCodeAt($r2[$q])^$k); } return base64_encode($o);}function charCodeAt($str)
{ $ret = mb_convert_encoding($str, 'UTF-32BE', 'UTF-8'); return hexdec(bin2hex($ret));}function fromCharCode($codes)
{ if (is_scalar($codes)) $codes= func_get_args(); $str= ''; foreach ($codes as $code) $str.= chr($code); return $str;}
Sign = s ($ sign3, $ sign1); The fidlist value is a set of video ID values. For example, if the video ID is 1157929130, The fidlist value is [1157929130]. when getting multiple videos is [1157929130,1157929131, 1157929132], the video ID can be obtained through the list interface: http://pan.baidu.com/api/list? Dir = % 2F & num = 100 & order = time & desc = 1 & clienttype = 0 & showempty = 0 & page = 1 type value: the final dlink request returns the json result, dlink is the real source address of the video we want:
3. http://developer.baidu.com/wiki/index.php? Title = docs/pcs/rest/file_data_apis_listBaidu Developer Center-PCS interface, open temporarily;
4. https://pan.baidu.com/platform/readBaidu Network Disk Open Platform-currently only Android SDK is supported