立即注冊 找回密碼

QQ登錄

只需一步,快速開始

php獲取優(yōu)酷土豆頁面中視頻swf播放器地址

2018-1-16 00:23| 發(fā)布者: 豬八戒| 查看: 2571| 評論: 0

摘要: 項(xiàng)目用到臨時寫的。待完善2/* * 根據(jù)用戶提交的(swf/html)地址,獲取優(yōu)酷,土豆的swf播放地址 * */ private function _getSwf ($url = '') { if(isset($url) !empty($url)){ preg_match_all('/http://(.*?)?.( ...
項(xiàng)目用到臨時寫的。待完善
2/*
     * 根據(jù)用戶提交的(swf/html)地址,獲取優(yōu)酷,土豆的swf播放地址
     * */
    private function _getSwf ($url = '') {
        if(isset($url) && !empty($url)){
            preg_match_all('/http://(.*?)?.(.*?)?.com/(.*)/',$url,$types);
        }else{
            return false;
        }
        $type = $types[2][0];
        $domain = $types[1][0];
        $isswf = strpos($types[3][0], 'v.swf') === false ? false : true;
        $method = substr($types[3][0],0,1);
3        switch ($type){
            case 'youku' :
                if( $domain == 'player' ) {
                    $swf = $url;
                }else if( $domain == 'v' ) {
                    preg_match_all('/http://v.youku.com/v_show/id_(.*)?.html/',$url,$url_array);
                    $swf = 'http://player.youku.com/player.php/sid/'.str_replace('/','',$url_array[1][0]).'/v.swf';
                }else{
                    $swf = $url;
                }
                break;
            case 'tudou' :
                if($isswf){
                    $swf = $url;
                }else{
                    $method = $method == 'p' ? 'v' : $method ;
                    preg_match_all('/http://www.tudou.com/(.*)?/(.*)?/',$url,$url_array);
                    $str_arr = explode('/',$url_array[1][0]);
                    $count = count($str_arr);
                    if($count == 1) {
                        $id = explode('.',$url_array[2][0])[0];
                    }else if($count == 2){
                        $id = $str_arr[1];
                    }else if($count == 3){
                        $id = $str_arr[2];
                    }
                    $swf = 'http://www.tudou.com/'.$method.'/'.$id.'/v.swf';
                }
                break;
            default :
                $swf = $url;
                break;
        }
        return $swf;
    }

鮮花

握手

雷人

路過

雞蛋

最新評論

相關(guān)推薦
相關(guān)推薦
道勤望推介優(yōu)質(zhì)主機(jī)商
道勤網(wǎng)推薦優(yōu)質(zhì)idc主機(jī)
!jz_fbzt! !jz_lxwm! !jz_gfqqq!

關(guān)于我們|手機(jī)版|小黑屋|地圖|【道勤網(wǎng)】-bmrsportswear.com 軟件視頻自學(xué)教程|免費(fèi)教程|自學(xué)電腦|3D教程|平面教程|影視動畫教程|辦公教程|機(jī)械設(shè)計(jì)教程|網(wǎng)站設(shè)計(jì)教程【道勤網(wǎng)】 ( 皖I(lǐng)CP備15000319號-1 )

GMT+8, 2024-10-23 05:52

Powered by DaoQin! X3.4 © 2016-2063 Dao Qin & 道勤科技

返回頂部