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);
            }
        }
    }
}
Example #3
0
 static function parseArrayShow($sitesObject)
 {
     $info = new VInfo();
     $sites = array();
     if (is_array($sitesObject)) {
         $sitesArray = $sitesObject;
         foreach ($sitesArray as $siteObject) {
             $site = array();
             if (is_object($siteObject)) {
                 if (property_exists($siteObject, 'site_info')) {
                     $site_info = $siteObject->site_info;
                     if (is_object($site_info) && property_exists($site_info, 'name')) {
                         $site['site_name'] = NBaidu::getSite($site_info->name);
                     }
                     if (is_object($site_info) && property_exists($site_info, 'site')) {
                         $site['site_url'] = $site_info->site;
                     }
                 }
                 $info->max_episode = '';
                 if (property_exists($siteObject, 'episodes')) {
                     $episodesArray = $siteObject->episodes;
                     if (is_array($episodesArray)) {
                         $episodes = array();
                         foreach ($episodesArray as $item) {
                             if (property_exists($item, 'single_title')) {
                                 $episode['name'] = $item->single_title;
                             }
                             if (property_exists($item, 'url')) {
                                 $episode['url'] = $item->url;
                             }
                             if (strpos($item->url, "baidu.com") !== false) {
                                 continue;
                             }
                             if (property_exists($item, 'episode')) {
                                 $episode['episode'] = $item->episode;
                                 if ($info->max_episode === "") {
                                     $info->max_episode = $item->episode;
                                 }
                             }
                             $episodes[] = $episode;
                         }
                         $site['episodes'] = $episodes;
                     }
                 }
                 if (!isN($site['site_name']) && $site['site_name'] !== null) {
                     $sites[] = $site;
                 }
             }
         }
     }
     $info->sites = $sites;
     return $info;
 }