发新话题
打印

56.com视频采集接口程序(PHP)

56.com视频采集接口程序(PHP)

56.com视频采集接口程序(PHP)


楼下也有一个所谓56站程序的,忽悠到了极致,不喜欢被人忽悠的,还是自己做个站吧!
我给大家个采集接口,你爱自己采集可以用自己的FLASH播放器直接播放56.com的flv吧!不用帮人家做免费广告那么傻了!
<?php
$url = "http://www.56.com/u75/v_MTkwMTIwMjQ.html";
$html = @file_get_contents($url);
preg_match_all("/var _oFlv_o = '([\S|\s]+)'/isU", $html, $matches);
$o = decode56($matches[1][0]);
include_once "json.php"; //当php没有配置支持json的时候有用
$o = str_replace("'", '"', $o);
$o = json_decode($o);
//print_r($o);
$swf = "http://www.56.com/n_" . str_replace(":88", "", str_replace(".56.com", "", $o->img_host)) .
                                "_/" . str_replace(".56.com", "", $o->URL_host) .
                                "_/" . $o->URL_pURL .
                                "_/" . $o->URL_sURL .
                                "_/" . $o->user_id .
                                "_/" . $o->URL_URLid .
                                "_/" . $o->totaltime .
                                "_/" . $o->effectID .
                                "_/" . $o->id . ".swf";
$flv = "http://hot-chinacache.56.com/flvdownload/" . $o->URL_pURL .
                                "/" . $o->URL_sURL .
                                "/" . $o->user_id .
                                "@56.com_56flv_" . $o->URL_URLid . ".flv";
echo "FLASH文件路径: " . $swf;
echo "<br>";
echo "FLV文件路径: " . $flv;

$de = 0;
function decode56($str) {
        global $de;
        $c1 = "";
        $c2 = "";
        $c3 = "";
        $c4 = "";
        $c5 = array(-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);
        $c6 = charCodeAt($str, 0);
        $c7 = "";
        $i = "";
        $len = "";
        $out = "";
        if(!$de) {
                $de = 1;
                $c7 = decode56($str);
                $str = substr($c7, $c6);
        }
        $len = strlen($str);
        $i = 1;
        $out = "";
        while ($i < $len) {
                do {
                        $c1 = $c5[charCodeAt($str, $i++) & 0xff];
                }
                while($i < $len && $c1 == -1);
                if ($c1 == -1) break;
                do {
                        $c2 = $c5[charCodeAt($str, $i++) & 0xff];
                }
                while ($i < $len && $c2 == -1);
                if($c2 == -1) break;
                $out .= chr(($c1 << 2) | (($c2 & 0x30) >> 4));
                do {
                        $c3 = charCodeAt($str, $i++) & 0xff;
                        if($c3 == 61) return $out;
                        $c3 = $c5[$c3];
                }
                while ($i < $len && $c3 == -1);
                if($c3 == -1) break;
                $out .= chr((($c2 & 0XF) << 4) | (($c3 & 0x3C) >> 2));
                do {
                        $c4 = charCodeAt($str, $i++) & 0xff;
                        if($c4 == 61) return $out;
                        $c4 = $c5[$c4];
                }
                while ($i < $len && $c4 == -1);
                if ($c4 == -1) break;
                $out .= chr((($c3 & 0x03) << 6) | $c4);
        }
        return $out;
}

function charCodeAt($str, $i){
        return ord(substr($str, $i, 1));
}

//该程序仅为技术交流,交流可加QQ群: 1714987
?>
附件: 您所在的用户组无法下载或查看附件

TOP

发新话题