static function parseMovieInfoByUrl($url, $p_code, $type)
 {
     $content = getPage($url, $p_code);
     return BaiduParse::parseMovieInfoByContent($content, $p_code, $type);
 }
function cjBaiduView($strlink, $num)
{
    global $starringarr, $titlearr, $picarr, $typearr, $areaarr, $yeararr, $strListUrl, $p_playspecialtype, $p_playtype, $p_videocodeType, $p_videocodeApiUrl, $p_id, $p_videocodeApiUrlParamstart, $p_videocodeApiUrlParamend, $p_videourlstart, $p_videourlend, $playcodeApiUrl, $playcodeApiUrlParamstart, $p_playcodeApiUrlParamend, $playcodeApiUrltype, $db, $strListUrl, $p_titletype, $starringarr, $titlearr, $picarr, $p_id, $p_titlestart, $p_titleend, $p_lzstart, $p_lzend, $p_hitsstart, $p_hitsend, $p_starringtype, $p_starringstart, $p_starringend, $p_picstart, $p_picend, $p_typestart, $p_typeend, $p_pictype, $p_classtype, $p_collect_type, $p_timestart, $p_timeend, $p_areastart, $p_areaend, $p_contentstart, $p_contentend, $p_playcodestart, $p_playcodeend, $p_playlinkstart, $p_playlinkend, $p_playurlstart, $p_playurlend, $p_playcodetype, $p_playlinktype, $p_playtype, $p_coding, $p_lzstart, $p_lzend, $p_lzcodetype, $p_lzcodestart, $p_lzcodeend, $p_languagestart, $p_languageend, $p_remarksstart, $p_remarksend, $p_script, $p_showtype, $p_savefiles, $strdstate, $p_server, $p_setnametype, $p_setnamestart, $p_setnameend, $p_directedstart, $p_directedend, $cache;
    $androidUrl = "";
    //var_dump($strlink);var_dump($strListUrl);
    try {
        $pos = strpos($strlink, "href=\"");
        if ($pos !== false) {
            $strlink = substr($strlink, $pos + 6);
        }
        $pos = strpos($strlink, "\"");
        if ($pos !== false) {
            $strlink = substr($strlink, 0, $pos);
        }
    } catch (Exception $e) {
    }
    $strlink = definiteUrl($strlink, $strListUrl);
    writetofile("crawel_info.log", $p_id . '{=====}' . $strlink . "{=====}View===start");
    echo "<tr><td colspan=\"2\">开始采集:" . $strlink . " / '.{$strListUrl}.'</br> </TD></TR>";
    $strViewCode = getPage($strlink, $p_coding);
    if ($strViewCode == false) {
        $strdstate = "true";
        echo "<tr><td colspan=\"2\">在获取内容页时出错:" . $strlink . " / '.{$strListUrl}.' </br></TD></TR>";
        writetofile("crawel_error.log", $p_id . '{=====}' . $strlink . '{=====}' . $strListUrl);
        $sb = $sb + 1;
        return;
    } else {
        $info = BaiduParse::parseMovieInfoByContent($strViewCode, $p_coding, $p_collect_type);
        //		var_dump($info);
        echo "<tr><td colspan=\"2\">在获取内容页时success :" . $strlink . " / '.{$strListUrl}.'</br> </TD></TR>";
        //节目名称,来自列表或者来自内容页
        if ($p_titletype == 1) {
            $titlecode = $titlearr[$num];
        } else {
            $titlecode = getBody($strViewCode, $p_titlestart, $p_titleend);
            if (isN($titlecode)) {
                $titlecode = $info->title;
            }
        }
        if (!isN($info->title)) {
            $titlecode = $info->title;
        }
        $titlecode = replaceStr($titlecode, "&nbsp;", ' ');
        $titlecode = filterScript($titlecode, $p_script);
        $titlecode = replaceFilters($titlecode, $p_id, 1, 0);
        $titlecode = replaceStr(replaceStr(replaceStr($titlecode, ",", " "), "'", ""), "\"\"", "");
        $titlecode = replaceStr($titlecode, "&nbsp;", ' ');
        $titlecode = trim($titlecode);
        //先缩小范围
        if ($p_lzcodetype == 1) {
            //连载范围
            $lzfwcode = getBody($strViewCode, $p_lzcodestart, $p_lzcodeend);
            //连载编码
            $lzcode = getBody($lzfwcode, $p_lzstart, $p_lzend);
            $lzcode = filterScript($lzcode, $p_script);
            $lzcode = replaceStr($lzcode, "false", "0");
            $lzcode = trim($lzcode);
            $lzcode = intval($lzcode);
        } else {
            $lzcode = getBody($strViewCode, $p_lzstart, $p_lzend);
            $lzcode = filterScript($lzcode, $p_script);
        }
        //		var_dump($lzcode);
        if (!isN($info->curr_episode)) {
            $lzcode = $info->curr_episode;
        }
        $lzcode = replaceStr($lzcode, "false", "0");
        $lzcode = trim($lzcode);
        try {
            $lzcode = intval($lzcode);
        } catch (Exception $e) {
            $lzcode = 0;
        }
        $p_hitsstart = 0;
        $p_hitsend = 0;
        $m_hits = 0;
        if ($p_starringtype == 1) {
            $starringcode = $starringarr[$num];
        } else {
            $starringcode = getBody($strViewCode, $p_starringstart, $p_starringend);
            if (!isN($info->actor)) {
                $starringcode = $info->actor;
            }
        }
        //演员
        $starringcode = filterScriptStar($starringcode, $p_script);
        $starringcode = replaceStr(replaceStr(replaceStr($starringcode, ",", " "), "'", ""), "\"\"", "");
        $starringcode = trim($starringcode);
        if ($p_pictype == 1) {
            $piccode = $picarr[$num];
        } else {
            $piccode = getBody($strViewCode, $p_picstart, $p_picend);
            if (!isN($info->big_poster)) {
                $piccode = $info->big_poster;
            }
        }
        //图片
        $piccode = trim($piccode);
        $piccode = getHrefFromImg(definiteUrl($piccode, $strListUrl));
        //栏目设置
        if ($p_classtype == 1) {
            $typecode = filterScript(getBody($strViewCode, $p_typestart, $p_typeend), $p_script);
            $typecode = trim($typecode);
            $m_typeid = changeId($typecode, $p_id, 0, 0);
        }
        if (isN($typecode) || $typecode === "") {
            $typecode = $typearr[$num];
            $typecode = trim($typecode);
        }
        $m_typeid = $p_collect_type;
        if (!isN($info->type)) {
            $typecode = $info->type;
        }
        $typecode = filterScript($typecode, $p_script);
        if ($p_showtype == 1) {
            echo "<tr><td  colspan=\"2\" align=\"center\">此列表中第" . ($num + 1) . "条数据采集结果</td></tr><tr><td width=\"20%\" >来源:</td><td >" . $strlink . "</td></tr><tr><td >名称:</td><td >" . $titlecode . " 连载:" . $lzcode . " 备注:" . $remarkscode . "</td></tr><tr><td >演员:</td><td >" . $starringcode . "</td></tr><tr><td >导演:</td><td >" . $directedcode . "</td></tr><tr><td >时间:</td><td >" . $timecode . "</td></tr><tr><td >分类:</td><td >" . $typecode . "</td></tr><tr><td >地区:</td><td >" . $areacode . "</td></tr><tr><td >语言:</td><td >" . $languagecode . "</td></tr><tr><td  >图片:</td><td >" . $piccode . "</td></tr><tr><td >介绍:</td><td >" . substring($contentcode, 50) . ".....</td></tr>";
            if ($p_savefiles == 1) {
                $filename = time() . $num;
                if (strpos($piccode, ".jpg") || strpos($piccode, ".bmp") || strpos($piccode, ".png") || strpos($piccode, ".gif")) {
                    $extName = substring($piccode, 4, strlen($piccode) - 4);
                } else {
                    $extName = ".jpg";
                }
                $picpath = "upload/vod/" . getSavePicPath() . "/";
                $picfile = $filename . $extName;
                echo "<tr><td width=\"20%\" >自动下载图片:</td><td><iframe border=\"0\" valign=\"bottom\" vspace=\"0\" hspace=\"0\" marginwidth=\"0\" marginheight=\"0\" framespacing=\"0\" frameborder=\"0\" scrolling=\"no\" width=\"400\" height=\"15\" src=\"../admin_pic.php?action=downpic&wjs=1&path=../" . $picpath . "&file=" . $picfile . "&url=" . $piccode . "\"></iframe></td></tr>";
                $piccode = $picpath . $picfile;
            }
        } else {
            echo "<tr><td colspan=\"2\" align=\"center\">第" . ($num + 1) . "条数据采集结果</td></tr><tr><td width=\"20%\" >来源:</td><td >" . $strlink . "</td></tr><tr><td width=\"20%\" >名称:</td><td >" . $titlecode . " 连载:" . $lzcode . " 备注:" . $remarkscode . "</td></tr>";
        }
        $weburl = $info->sites;
        if ($weburl == false) {
            echo "<tr><td colspan=\"2\">在获取播放列表链接时出错 " . $strlink . " / '.{$strListUrl}.'</TD></TR>";
            writetofile("crawel_error.log", $p_id . '{=====}' . $strlink . '{=====}' . $strListUrl);
            $sb = $sb + 1;
            return;
        } else {
            $directedcode = filterScriptStar(getBody($strViewCode, $p_directedstart, $p_directedend), $p_script);
            $directedcode = replaceStr($directedcode, "false", "");
            $directedcode = replaceStr($directedcode, "'", "");
            $directedcode = trim($directedcode);
            if (!isN($info->director)) {
                $directedcode = $info->director;
            }
            //备注
            $remarkscode = filterScript(getBody($strViewCode, $p_remarksstart, $p_remarksend), $p_script);
            $remarkscode = replaceStr($remarkscode, "false", "");
            $remarkscode = trim($remarkscode);
            if (!isN($info->max_episode)) {
                $remarkscode = $info->max_episode;
            }
            //语音
            $languagecode = filterScript(getBody($strViewCode, $p_languagestart, $p_languageend), $p_script);
            $languagecode = replaceStr($languagecode, "false", "");
            $languagecode = !isN($info->language) ? $info->language : $languagecode;
            $languagecode = trim($languagecode);
            if (!isN($languagecode) && $languagecode !== '英语' && strpos($titlecode, $languagecode) === false) {
                $titlecode = $titlecode . ' ' . $languagecode;
            } else {
                $languagecode = '其他';
            }
            //时间
            $timecode = filterScript(getBody($strViewCode, $p_timestart, $p_timeend), $p_script);
            if ($timecode == false) {
                $timecode == "未知";
            }
            $timecode = trim($timecode);
            $timecode = !isN($info->pubdate) ? $info->pubdate : $timecode;
            $timecode = trim(replaceStr($timecode, "&nbsp;", ' '));
            $timecode = trim($timecode);
            if (isN($timecode) || $timecode === "") {
                $timecode = $yeararr[$num];
                $timecode = trim($timecode);
            }
            //地区
            $areacode = filterScript(getBody($strViewCode, $p_areastart, $p_areaend), $p_script);
            if ($areacode == false) {
                $areacode = "未知";
            }
            $areacode = !isN($info->area) ? $info->area : $areacode;
            $areacode = trim($areacode);
            if (isN($areacode) || $areacode === "") {
                $areacode = $areaarr[$num];
                $areacode = trim($areacode);
            }
            //内容
            $contentcode = filterScript(getBody($strViewCode, $p_contentstart, $p_contentend), $p_script);
            if ($contentcode == false) {
                $contentcode = "未知";
            }
            $contentcode = !isN($info->brief) ? $info->brief : $contentcode;
            $contentcode = filterScript(replaceFilters($contentcode, $p_id, 2, 0), $p_script);
            $contentcode = replaceStr(replaceStr(replaceStr($contentcode, ",", " "), "'", ""), "\"\"", "");
            $contentcode = trim($contentcode);
            //备注
            $duration = getBody($strViewCode, $p_playurlstart, $p_playurlend);
            $duration = !isN($info->duration) ? $info->duration : $duration;
            //var_dump($info->duration); var_dump($duration);
            $m_area = $areacode;
            $m_languageid = $languagecode;
            $piccode = "";
            foreach ($weburl as $weburlitem) {
                $p_playtypebaiduweb = $weburlitem['site_name'];
                $baiduwebUrls = $weburlitem['episodes'];
                //				var_dump($p_playtypebaiduweb);
                //				var_dump('----------------');
                //				var_dump($weburlitem);
                $movieid = updateVod($duration, $baiduwebUrls, $p_id, $titlecode, $piccode, $typecode, $areacode, $strlink, $starringcode, $directedcode, $timecode, $p_playtypebaiduweb, $contentcode, $m_typeid, $lzcode, $languagecode, $remarkscode);
            }
        }
    }
}