function cjBaiduView($m_id, $id, $p_id, $p_collect_type, $m_playfrom)
{
    if (isN($id) || $id === "") {
        writetofile("auto_crawel_error.log", $id);
        return;
    } else {
        $info = NBaidu::parseMovieInfoById($id, $p_collect_type);
        //视频连载备注信息
        if ($p_collect_type === '2' || $p_collect_type === '131') {
            $lzcode = $info->max_episode;
            $remarksarr = NBaidu::getRemarks($id, $p_collect_type);
            $remarkscode = '';
            if ($remarksarr["remarkcode"] !== "" && $remarksarr["remarkcode"] !== "0") {
                $remarkscode = $remarksarr["remarkcode"];
            }
        } else {
            $lzcode = $info->max_episode;
            $remarkscode = $lzcode;
        }
        $lzcode = trim($lzcode);
        try {
            $lzcode = intval($lzcode);
        } catch (Exception $e) {
            $lzcode = 0;
        }
        $weburl = $info->sites;
        if (count($weburl) <= 0) {
            echo "<tr><td colspan=\"2\" align=\"center\"><span style=\"color:red\">第条数据采集结果----获取播放列表链接时出错</td></tr><tr><td width=\"20%\" >来源:</td><td ></td></tr><tr><td width=\"20%\" >名称:</td><td > 连载:" . $lzcode . " 备注:" . $remarkscode . "</span></br></td></tr>";
            writetofile("crawel_error.log", $p_collect_type . '{=====}{=====}');
            return;
        } else {
            echo "<tr><td colspan=\"2\" align=\"center\">第条数据采集结果</td></tr><tr><td width=\"20%\" >来源:</td><td ></td></tr><tr><td width=\"20%\" >名称:</td><td > 连载:" . $lzcode . " 备注:" . $remarkscode . "</br></td></tr>";
            foreach ($weburl as $weburlitem) {
                $p_playtypebaiduweb = $weburlitem['site_name'];
                $baiduwebUrls = $weburlitem['episodes'];
                if ($m_playfrom === $p_playtypebaiduweb) {
                    updateVod($m_id, $baiduwebUrls, $p_id, $p_collect_type, $p_playtypebaiduweb, $lzcode, $remarkscode);
                }
            }
        }
    }
}
function cjBaiduView($id, $num)
{
    global $p_id, $idarr, $linkarr, $starringarr, $titlearr, $picarr, $areaarr, $yeararr, $typearr, $p_collect_type, $finisharr, $introarr, $directorarr, $durationarr;
    global $count;
    //    echo "<tr><td colspan=\"2\">开始采集:".$id." / '.$linkarr[$num].'</br> </TD></TR>";
    if (isN($id) || $id === "") {
        //        echo "<tr><td colspan=\"2\">在获取内容页时出错:".$id." / '.$linkarr[$num].' </br></TD></TR>";
        writetofile("crawel_error.log", $id . '{=====}' . $linkarr[$num]);
        return;
    } else {
        $info = NBaidu::parseMovieInfoById($id, $p_collect_type);
        //        echo "<tr><td colspan=\"2\">在获取内容页时success :".$id." / '.$linkarr[$num].'</br> </TD></TR>";
        //节目名称,来自列表或者来自内容页
        $titlecode = $titlearr[$num];
        //        $titlecode =replaceStr($titlecode, "&nbsp;", ' ');
        //        $titlecode = filterScript($titlecode,"gb2312");
        //        $titlecode = replaceStr(replaceStr(replaceStr($titlecode,","," "),"'",""),"\"\"","");
        //        $titlecode =replaceStr($titlecode, "&nbsp;", ' ');
        $titlecode = trim($titlecode);
        if (isN($titlecode) || $titlecode === "") {
            echo "<tr><td colspan=\"2\" align=\"center\"><span style=\"color:red\">第" . $count . "条数据采集结果----获取播放列表链接时出错</td></tr><tr><td width=\"20%\" >来源:</td><td >" . $strlink . "</td></tr><tr><td width=\"20%\" >名称:</td><td >" . $titlecode . " 连载:" . $lzcode . " 备注:" . $remarkscode . "</span></br></td></tr>";
            writetofile("crawel_title_error.log", $id . '{=====}{=====}');
            return;
        }
        //百度网页地址
        $strlink = $linkarr[$num];
        //是否完结
        $isfinish = $finisharr[$num];
        //视频连载备注信息
        if ($isfinish === "0" && ($p_collect_type === '2' || $p_collect_type === '131')) {
            $lzcode = $info->max_episode;
            $remarksarr = NBaidu::getRemarks($id, $p_collect_type);
            $remarkscode = '';
            if ($remarksarr["remarkcode"] !== "" && $remarksarr["remarkcode"] !== "0") {
                $remarkscode = $remarksarr["remarkcode"];
            }
        } else {
            $lzcode = $info->max_episode;
            $remarkscode = $lzcode;
        }
        $lzcode = trim($lzcode);
        try {
            $lzcode = intval($lzcode);
        } catch (Exception $e) {
            $lzcode = 0;
        }
        //演员信息
        $starringcode = $starringarr[$num];
        $starringcode = trim($starringcode);
        //图片
        //栏目设置
        $typecode = $typearr[$num];
        $typecode = trim($typecode);
        //视频类型
        $m_typeid = $p_collect_type;
        //导演信息
        $directorcode = $directorarr[$num];
        $directorcode = trim($directorcode);
        //语言
        $languagecode = '其他';
        //时间
        $timecode = $yeararr[$num];
        $timecode = trim($timecode);
        if (isN($timecode) || $timecode === "") {
            timecode == "未知";
        }
        //地区
        $areacode = $areaarr[$num];
        $areacode = trim($areacode);
        if (isN($areacode) || $areacode === "") {
            $areacode = "未知";
        }
        //内容
        $contentcode = $introarr[$num];
        $contentcode = trim($contentcode);
        if (isN($contentcode) || $contentcode === "") {
            $contentcode = "未知";
        }
        //时长
        $duration = $durationarr[$num];
        $weburl = $info->sites;
        if (count($weburl) <= 0) {
            echo "<tr><td colspan=\"2\" align=\"center\"><span style=\"color:red\">第" . $count . "条数据采集结果----获取播放列表链接时出错</td></tr><tr><td width=\"20%\" >来源:</td><td >" . $strlink . "</td></tr><tr><td width=\"20%\" >名称:</td><td >" . $titlecode . " 连载:" . $lzcode . " 备注:" . $remarkscode . "</span></br></td></tr>";
            writetofile("crawel_error.log", $m_typeid . '{=====}' . $strlink . '{=====}');
            return;
        } else {
            echo "<tr><td colspan=\"2\" align=\"center\">第" . $count . "条数据采集结果</td></tr><tr><td width=\"20%\" >来源:</td><td >" . $strlink . "</td></tr><tr><td width=\"20%\" >名称:</td><td >" . $titlecode . " 连载:" . $lzcode . " 备注:" . $remarkscode . "</br></td></tr>";
            $piccode = "";
            foreach ($weburl as $weburlitem) {
                $p_playtypebaiduweb = $weburlitem['site_name'];
                $baiduwebUrls = $weburlitem['episodes'];
                updateVod($duration, $baiduwebUrls, $p_id, $titlecode, $piccode, $typecode, $areacode, $strlink, $starringcode, $directorcode, $timecode, $p_playtypebaiduweb, $contentcode, $m_typeid, $lzcode, $languagecode, $remarkscode);
            }
        }
    }
}
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);
            }
        }
    }
}
function cjAPIView($info)
{
    $strlink = $info->videoUrl;
    $p_id = $info->p_id;
    $titlecode = $info->title;
    $titlecode = filterScript($titlecode, $p_script);
    $titlecode = replaceFilters($titlecode, $p_id, 1, 0);
    $titlecode = replaceStr(replaceStr(replaceStr($titlecode, ",", " "), "'", ""), "\"\"", "");
    $titlecode = trim($titlecode);
    $lzcode = $info->curr_episode;
    $lzcode = replaceStr($lzcode, "false", "0");
    $lzcode = trim($lzcode);
    try {
        $lzcode = intval($lzcode);
    } catch (Exception $e) {
        $lzcode = 0;
    }
    //演员
    $starringcode = $info->actor;
    $piccode = $info->big_poster;
    //图片
    $piccode = trim($piccode);
    $m_typeid = $info->typeid;
    $typecode = !isN($info->type) ? $info->type : "其他";
    $typecode = filterScript($typecode, $p_script);
    $weburl = $info->sites;
    if ($weburl == false) {
        return;
    } else {
        $directedcode = "";
        if (!isN($info->director)) {
            $directedcode = $info->director;
        }
        //备注
        $remarkscode = "";
        if (!isN($info->max_episode)) {
            $remarkscode = $info->max_episode;
        }
        $languagecode = !isN($info->language) ? $info->language : "其他";
        $languagecode = trim($languagecode);
        $areacode = !isN($info->area) ? $info->area : "其他";
        $areacode = trim($areacode);
        $contentcode = !isN($info->brief) ? $info->brief : "";
        $contentcode = filterScript(replaceFilters($contentcode, $p_id, 2, 0), $p_script);
        $contentcode = replaceStr(replaceStr(replaceStr($contentcode, ",", " "), "'", ""), "\"\"", "");
        $contentcode = trim($contentcode);
        $timecode = !isN($info->pubdate) ? $info->pubdate : "其他";
        $duration = !isN($info->duration) ? $info->duration : "";
        $m_area = $areacode;
        $m_languageid = $languagecode;
        foreach ($weburl as $weburlitem) {
            $p_playtypebaiduweb = $weburlitem['site_name'];
            $baiduwebUrls = $weburlitem['episodes'];
            $movieid = updateVod($duration, $baiduwebUrls, $p_id, $titlecode, $piccode, $typecode, $areacode, $strlink, $starringcode, $directedcode, $timecode, $p_playtypebaiduweb, $contentcode, $m_typeid, $lzcode, $languagecode, $remarkscode);
        }
    }
}