function cjView($strlink, $num) { global $starringarr, $titlearr, $picarr, $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_auto_info.log", $p_id . '{=====}' . $strlink . "{=====}View===start"); $strViewCode = getPage($strlink, $p_coding); if ($strViewCode == false) { $strdstate = "true"; writetofile("crawel_auto_error.log", $p_id . '{=====}' . $strlink . '{=====}' . $strListUrl); $sb = $sb + 1; return; } else { //节目名称,来自列表或者来自内容页 if ($p_titletype == 1) { $titlecode = $titlearr[$num]; } else { $titlecode = getBody($strViewCode, $p_titlestart, $p_titleend); } // var_dump($titlearr[$num]); $titlecode = filterScript($titlecode, $p_script); $titlecode = replaceFilters($titlecode, $p_id, 1, 0); $titlecode = replaceStr(replaceStr(replaceStr($titlecode, ",", " "), "'", ""), "\"\"", ""); $titlecode = trim($titlecode); // $sql="select count(*) as cc from {pre}cj_vod where m_name='".$titlecode."' and m_playfrom='".$p_playtype."'"; // $row=$db->getOne($sql); // //var_dump($row);var_dump($titlecode); // $rowcount = $row; //先缩小范围 if ($p_lzcodetype == 1) { //连载范围 $lzfwcode = getBody($strViewCode, $p_lzcodestart, $p_lzcodeend); //连载编码 $lzcode = getBody($lzfwcode, $p_lzstart, $p_lzend); $lzcode = replaceStr($lzcode, "false", "0"); $lzcode = trim($lzcode); $lzcode = intval($lzcode); } else { $lzcode = getBody($strViewCode, $p_lzstart, $p_lzend); $lzcode = replaceStr($lzcode, "false", "0"); $lzcode = trim($lzcode); $lzcode = intval($lzcode); } // if ($p_playcodetype !=2 &&($lzcode == 0) && ($rowcount>0)) { // $strdstate = "true"; // echo "<tr><td colspan=\"2\">遇到重复电影数据跳过采集!</TD></TR>"; // return; // } if (isN($p_hitsstart) || !isnum($p_hitsstart)) { $p_hitsstart = 0; } if (isN($p_hitsend) || !isnum($p_hitsend)) { $p_hitsend = 0; } if ($p_hitsstart == 0 && $p_hitsend == 0) { $m_hits = 0; } else { $m_hits = rand($p_hitsend, $p_hitsstart); } if ($p_starringtype == 1) { $starringcode = $starringarr[$num]; } else { $starringcode = getBody($strViewCode, $p_starringstart, $p_starringend); } //演员 $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); } //图片 $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); } else { $typecode = $p_collect_type; $typecode = trim($typecode); $m_typeid = $p_collect_type; $typearr = getValueByArray($cache[0], "t_id", $typecode); $typecode = $typearr["t_name"]; } if ($m_typeid == 0) { $m_typeid = $p_collect_type; } $typecode = filterScript($typecode, $p_script); //导演 $directedcode = filterScriptStar(getBody($strViewCode, $p_directedstart, $p_directedend), $p_script); $directedcode = replaceStr($directedcode, "false", ""); $directedcode = replaceStr($directedcode, "'", ""); $directedcode = trim($directedcode); //备注 $remarkscode = filterScript(getBody($strViewCode, $p_remarksstart, $p_remarksend), $p_script); $remarkscode = replaceStr($remarkscode, "false", ""); $remarkscode = trim($remarkscode); //语音 $languagecode = filterScript(getBody($strViewCode, $p_languagestart, $p_languageend), $p_script); $languagecode = replaceStr($languagecode, "false", "未知"); $languagecode = trim($languagecode); //时间 $timecode = filterScript(getBody($strViewCode, $p_timestart, $p_timeend), $p_script); if ($timecode == false) { $timecode == "未知"; } $timecode = trim($timecode); //地区 $areacode = filterScript(getBody($strViewCode, $p_areastart, $p_areaend), $p_script); if ($areacode == false) { $areacode = "未知"; } $areacode = trim($areacode); //内容 $contentcode = filterScript(getBody($strViewCode, $p_contentstart, $p_contentend), $p_script); if ($contentcode == false) { $contentcode = "未知"; } $contentcode = filterScript(replaceFilters($contentcode, $p_id, 2, 0), $p_script); $contentcode = replaceStr(replaceStr(replaceStr($contentcode, ",", " "), "'", ""), "\"\"", ""); $contentcode = trim($contentcode); $m_area = $areacode; $m_languageid = $languagecode; //播放列表,缩小 if ($p_playcodetype == 1) { $playcode = getBody($strViewCode, $p_playcodestart, $p_playcodeend); //获取地址设置 if ($p_playlinktype > 0) { //播放链接 $weburl = getArray($playcode, $p_playlinkstart, $p_playlinkend); } else { //内容页直接获取地址, 地址开始 $weburl = getArray($playcode, $p_playurlstart, $p_playurlend); } if ($p_setnametype == 3) { $setnames = getArray($playcode, $p_setnamestart, $p_setnameend); } } else { if ($p_playcodetype == 2) { //from api // writetofile("d:\\s.txt",$linkcode) ; // echo $p_playcodeApiUrlParamend .'=='.$playcodeApiUrlParamstart; // echo $playcodeApiUrlParamstart .'\n' .$p_playcodeApiUrlParamend .' = '.$playcodeApiUrltype; if ($playcodeApiUrltype == 0) { $paracode = getBody($strViewCode, $playcodeApiUrlParamstart, $p_playcodeApiUrlParamend); } else { $paracode = getBody($UrlTestMoive, $playcodeApiUrlParamstart, $p_playcodeApiUrlParamend); } // echo $paracode; $p_apibatchurl = replaceStr($playcodeApiUrl, "{PROD_ID}", $paracode); $p_apibatchurls = replaceStr($p_apibatchurl, "{PAGE_NO}", 1); $playcode = getFormatPage($p_apibatchurls, $p_coding); $weburl = getArray($playcode, $p_playlinkstart, $p_playlinkend); $page_num = 2; // echo "page 1 :".$weburl .'\n'; $flag = true; while ($flag && $page_num < 15 && strpos($playcodeApiUrl, "{PAGE_NO}") !== false) { $p_apibatchurls = replaceStr($p_apibatchurl, "{PAGE_NO}", $page_num); // echo $p_apibatchurls .'\n'; $playcode = getFormatPage($p_apibatchurls, $p_coding); $weburls = getArray($playcode, $p_playlinkstart, $p_playlinkend); // echo "page ".$page_num." :".$weburls .'\n'; if ($weburls) { $weburl = $weburl . "{Array}" . $weburls; $page_num = $page_num + 1; } else { $flag = false; } } // var_dump($weburl); // if ($p_playlinktype >0) { // $weburl = getArray($playcode,$p_playlinkstart,$p_playlinkend); // } // else{ // $weburl = getArray($playcode,$p_playurlstart,$p_playurlend); // // var_dump($playcode); // } // if ($p_setnametype == 3) { // $setnames = getArray($playcode,$p_setnamestart,$p_setnameend); // } } else { if ($p_playlinktype > 0) { $weburl = getArray($strViewCode, $p_playlinkstart, $p_playlinkend); // var_dump($weburl); } else { $weburl = getArray($strViewCode, $p_playurlstart, $p_playurlend); $androidUrl = ContentProviderFactory::getContentProvider($p_playtype)->parseAndroidVideoUrlByContent($strViewCode, $p_coding, $p_script); $videoAddressUrl = ContentProviderFactory::getContentProvider($p_playtype)->parseIOSVideoUrlByContent($strViewCode, $p_coding, $p_script); writetofile("android_log.txt", $strlink . '{===}' . $androidUrl . '{===}' . $videoAddressUrl); } if ($p_setnametype == 3) { $setnames = getArray($strViewCode, $p_setnamestart, $p_setnameend); } } } if ($p_showtype == 1) { 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>"; } if ($weburl == false) { // echo "<tr><td colspan=\"2\">在获取播放列表链接时出错 ".$strlink." / '.$strListUrl.'</TD></TR>"; writetofile("crawel_auto_error.log", $p_id . '{=====}' . $strlink . '{=====}' . $strListUrl); // $sb=$sb+1; return; } else { $sql = "select m_id,m_name,m_type,m_area,m_playfrom,m_starring,m_directed,m_pic,m_content,m_year,m_addtime,m_urltest,m_zt,m_pid,m_typeid,m_hits,m_playserver,m_state from {pre}cj_vod where m_pid='" . $p_id . "' and m_name='" . $titlecode . "' order by m_id desc"; $rowvod = $db->getRow($sql); if ($rowvod) { $cg = $cg + 1; $movieid = $rowvod["m_id"]; if (isN($titlecode)) { $titlecode = $rowvod["m_name"]; } if (isN($starringcode)) { $starringcode = $rowvod["m_starring"]; } if (isN($piccode)) { $piccode = $rowvod["m_pic"]; } $sql = "update {pre}cj_vod set m_pic='" . $piccode . "', m_type='" . $typecode . "',m_area='" . $areacode . "',m_urltest='" . $strlink . "',m_name='" . $titlecode . "',m_starring='" . $starringcode . "',m_directed='" . $directedcode . "',m_year='" . $timecode . "',m_playfrom='" . $p_playtype . "',m_content='" . $contentcode . "',m_addtime='" . date('Y-m-d H:i:s', time()) . "',m_zt='0',m_pid='" . $p_id . "',m_typeid='" . $m_typeid . "',m_playserver='" . $p_server . "',m_state='" . $lzcode . "',m_language='" . $languagecode . "',m_remarks='" . $remarkscode . "' where m_id=" . $rowvod["m_id"]; writetofile("sql.txt", $sql); $db->query($sql); // $sql="delete from {pre}cj_vod_url where u_movieid=".$rowvod["m_id"]; // writetofile("sql.txt", $sql); // $db->query($sql); } else { $cg = $cg + 1; $sql = "insert {pre}cj_vod (m_name,m_type,m_area,m_playfrom,m_starring,m_directed,m_pic,m_content,m_year,m_urltest,m_zt,m_pid,m_typeid,m_hits,m_playserver,m_state,m_addtime,m_language,m_remarks) values('" . $titlecode . "','" . $typecode . "','" . $areacode . "','" . $p_playtype . "','" . $starringcode . "','" . $directedcode . "','" . $piccode . "','" . $contentcode . "','" . $timecode . "','" . $strlink . "','0','" . $p_id . "','" . $m_typeid . "','" . $m_hits . "','" . $p_server . "','" . $lzcode . "','" . date('Y-m-d H:i:s', time()) . "','" . $languagecode . "','" . $remarkscode . "')"; writetofile("sql.txt", $sql); $db->query($sql); $movieid = $db->insert_id(); } $webArray = explode("{Array}", $weburl); $setnamesArray = explode("{Array}", $setnames); $webArraTemp = array(); $index = 0; $webUrls = ''; for ($i = 0; $i < count($webArray); $i++) { $UrlTemp = $webArray[$i]; if (strpos($webUrls, $UrlTemp . '<array>') === false) { $webArraTemp[$index] = $UrlTemp; $webUrls = $webUrls . $UrlTemp . '<array>'; $index++; } } // writetofile("d:\\ssssss.txt","p_videocodeType:".$p_videocodeType); $webArray = $webArraTemp; //http://www.youku.com/show_episode/id_zc16d0492e81411e196ac.html?dt=json&divid=reload_1&__rt=1&__ro=reload_1 for ($i = 0; $i < count($webArray); $i++) { $WebTestx = $webArray[$i]; if ($p_playspecialtype == 1 && strpos("," . $p_playspecialrrul, "[变量]")) { $Keyurl = explode("[变量]", $p_playspecialrrul); $urli = getBody($UrlTest, $Keyurl[0], $Keyurl[1]); if ($urli == false) { break; } $WebTestx = replaceStr($p_playspecialrerul, "[变量]", $urli); } if ($p_playspecialtype == 2) { $urArray = explode("/", $strlink); $ur = ""; for ($k = 0; $k < count($urArray) - 1; $k++) { $ur = $ur . $urArray[$k] . "/"; } $WebTestx = $ur . $WebTestx . ".html"; } writetofile("crawel_auto_info.log", $p_id . '{=====}' . $WebTestx . "{=====}ViewList===start"); if ($p_playlinktype == 1) { //播放页获取地址 $WebTestx = getHrefFromLink($WebTestx); $WebTestx = definiteUrl($WebTestx, $strListUrl); $playCode = getPage($WebTestx, $p_coding); $androidUrl = ContentProviderFactory::getContentProvider($p_playtype)->parseAndroidVideoUrlByContent($playCode, $p_coding, $p_script); $videoAddressUrl = ContentProviderFactory::getContentProvider($p_playtype)->parseIOSVideoUrlByContent($playCode, $p_coding, $p_script); writetofile("android_log.txt", $strlink . '{===}' . $androidUrl . '{===}' . $videoAddressUrl); $url = getBody($playCode, $p_playurlstart, $p_playurlend); $url = replaceLine($url); } else { if ($p_playlinktype == 2) { //播放链接中获取地址 $WebTestx = getHrefFromLink($WebTestx); if (isN($p_playurlend)) { $tmpA = strpos($WebTestx, $p_playurlstart); $url = substr($WebTestx, strlen($WebTestx) - $tmpA - strlen($p_playurlstart) + 1); } else { $url = getBody($WebTestx, $p_playurlstart, $p_playurlend); } } else { if ($p_playlinktype == 3) { //单播放页获取所有播放地址 $WebTestx = getHrefFromLink($WebTestx); $playCode = getPage($WebTestx, $p_coding); $tmpB = getArray($webCode, $p_playurlstart, $p_playurlend); $tmpC = explode("{$Array}\$", $tmpB); foreach ($tmpC as $tmpD) { $sql = "SELECT {pre}vod_url.u_url FROM ({pre}vod_url INNER JOIN {pre}vod ON {pre}vod_url.u_movieid = {pre}vod.m_id) where {pre}vod_url.u_url='" . $tmpD . "' and {pre}vod.m_pid=" . $p_id; $row = $db->getRow($sql); if (!$row) { $strTempUrl = $strTempUrl . $tmpD . "<br>"; $db->query("insert into {pre}vod_url(u_url,u_movieid) values('" . $tmpD . "','" . $movieid . "')"); } } break; } else { $url = $WebTestx; $url = replaceLine($url); } } } $url = replaceFilters($url, $p_id, 3, 0); if ($p_setnametype == 1) { $setname = getBody($url, $p_setnamestart, $p_setnameend); // $url = $setname . "$" . $url; } else { if ($p_setnametype == 2 && $p_playlinktype == 1) { $setname = getBody($playCode, $p_setnamestart, $p_setnameend); // $url = $setname ."$" .$url; } else { if ($p_setnametype == 3) { $setname = $setnamesArray[$i]; } } } $sql = "SELECT {pre}cj_vod_url.u_url FROM ({pre}cj_vod_url INNER JOIN {pre}cj_vod ON {pre}cj_vod_url.u_movieid = {pre}cj_vod.m_id) where {pre}cj_vod_url.u_url='" . $url . "' and {pre}cj_vod.m_pid=" . $p_id . " and {pre}cj_vod.m_id=" . $movieid; $rowurl = $db->getRow($sql); // writetofile("d:\\sql.txt",$rowurl); if (!$rowurl) { if ($p_playlinktype == 1) { $strTempUrl .= $url . "<br>"; $url = replaceStr($url, "'", "''"); writetofile("sql.txt", "insert into {pre}cj_vod_url(u_url,u_movieid,u_weburl,iso_video_url,name,android_vedio_url) values('" . $url . "','" . $movieid . "','" . getHrefFromLink($WebTestx) . "','" . getHrefFromLink($videoAddressUrl) . "','" . filterScriptStar($setname, $p_script) . "' ,'" . $androidUrl . "' )"); $db->query("insert into {pre}cj_vod_url(u_url,u_movieid,u_weburl,iso_video_url,name,android_vedio_url) values('" . $url . "','" . $movieid . "','" . getHrefFromLink($WebTestx) . "','" . getHrefFromLink($videoAddressUrl) . "','" . filterScriptStar($setname, $p_script) . "' ,'" . $androidUrl . "' )"); } else { $strTempUrl .= $url . "<br>"; writetofile("sql.txt", "insert into {pre}cj_vod_url(u_url,u_movieid,iso_video_url,u_weburl,android_vedio_url) values('" . $url . "','" . $movieid . "','" . getHrefFromLink($videoAddressUrl) . "','" . getHrefFromLink($strlink) . "', '" . $androidUrl . "')"); $db->query("insert into {pre}cj_vod_url(u_url,u_movieid,iso_video_url,u_weburl,android_vedio_url) values('" . $url . "','" . $movieid . "','" . getHrefFromLink($videoAddressUrl) . "','" . getHrefFromLink($strlink) . "', '" . $androidUrl . "')"); } } } } } $cg = $cg + 1; }
function lastsave() { global $db, $cache; $p_id = be("all", "p_id"); $p_timestart = be("post", "p_timestart"); $p_timeend = be("post", "p_timeend"); $p_areastart = be("post", "p_areastart"); $p_areaend = be("post", "p_areaend"); $p_classtype = be("post", "p_classtype"); $p_collect_type = be("post", "p_collect_type"); $p_typestart = be("post", "p_typestart"); $p_typeend = be("post", "p_typeend"); $p_contentstart = be("post", "p_contentstart"); $p_contentend = be("post", "p_contentend"); $p_playcodetype = be("post", "p_playcodetype"); $p_playcodestart = be("post", "p_playcodestart"); $p_playcodeend = be("post", "p_playcodeend"); $p_playurlstart = be("post", "p_playurlstart"); $p_playurlend = be("post", "p_playurlend"); $p_playlinktype = be("post", "p_playlinktype"); $p_playlinkstart = be("post", "p_playlinkstart"); $p_playlinkend = be("post", "p_playlinkend"); $p_playspecialtype = be("post", "p_playspecialtype"); $p_playspecialrrul = be("post", "p_playspecialrrul"); $p_timestart = be("post", "p_timestart"); $p_playspecialrerul = be("post", "p_playspecialrerul"); $p_starringtype = be("post", "p_starringtype"); $p_starringstart = be("post", "p_starringstart"); $p_starringend = be("post", "p_starringend"); $p_titletype = be("post", "p_titletype"); $p_pictype = be("post", "p_pictype"); $p_pagetype = be("all", "p_pagetype"); $p_listcodestart = be("post", "p_listcodestart"); $p_listcodeend = be("post", "p_listcodeend"); $p_titlestart = be("post", "p_titlestart"); $p_titleend = be("post", "p_titleend"); $p_listlinkstart = be("post", "p_listlinkstart"); $p_listlinkend = be("post", "p_listlinkend"); $p_picstart = be("post", "p_picstart"); $p_picend = be("post", "p_picend"); $p_lzstart = be("post", "p_lzstart"); $p_lzend = be("post", "p_lzend"); $strlisturl = be("post", "listurl"); $p_coding = be("post", "p_coding"); $p_lzcodetype = be("post", "p_lzcodetype"); $p_lzcodestart = be("post", "p_lzcodestart"); $p_lzcodeend = be("post", "p_lzcodeend"); $p_languagestart = be("post", "p_languagestart"); $p_languageend = be("post", "p_languageend"); $p_remarksstart = be("post", "p_remarksstart"); $p_remarksend = be("post", "p_remarksend"); $p_directedstart = be("post", "p_directedstart"); $p_directedend = be("post", "p_directedend"); $p_setnametype = be("post", "p_setnametype"); $p_setnamestart = be("post", "p_setnamestart"); $p_setnameend = be("post", "p_setnameend"); $p_setnametype = be("post", "p_setnametype"); $p_playtype = be("post", "p_playtype"); //api start $playcodeApiUrl = be("post", "p_playcodeApiUrl"); $playcodeApiUrltype = be("post", "p_playcodeApiUrltype"); $p_playcodeApiUrlParamend = be("post", "p_playcodeApiUrlParamend"); $playcodeApiUrlParamstart = be("post", "p_playcodeApiUrlParamstart"); if (isN($playcodeApiUrltype)) { $playcodeApiUrltype = 0; } $p_videocodeApiUrl = be("post", "p_videocodeApiUrl"); $p_videocodeApiUrlParamstart = be("post", "p_videocodeApiUrlParamstart"); $p_videocodeApiUrlParamend = be("post", "p_videocodeApiUrlParamend"); $p_videourlstart = be("post", "p_videourlstart"); $p_videourlend = be("post", "p_videourlend"); $p_videocodeType = be("post", "p_videocodeType"); //api end if (isN($p_videocodeType)) { $p_videocodeType = 0; } if (isN($p_starringtype)) { $p_starringtype = 0; } if (isN($p_titletype)) { $p_titletype = 0; } if (isN($p_pictype)) { $p_pictype = 0; } $sql = "select * from {pre}cj_vod_projects Where p_id=" . $p_id; $row = $db->getRow($sql); $p_pagetype = $row["p_pagetype"]; $strSet = ""; if ($p_pagetype == 3 || $p_starringtype == 0) { $strSet .= "p_starringstart='" . $p_starringstart . "',p_starringend='" . $p_starringend . "',"; } else { $p_starringstart = $row["p_starringstart"]; $p_starringend = $row["p_starringend"]; } if ($p_pagetype == 3 || $p_titletype == 0) { $strSet .= "p_titlestart='" . $p_titlestart . "',p_titleend='" . $p_titleend . "',"; } else { $p_titlestart = $row["p_titlestart"]; $p_titleend = $row["p_titleend"]; } if ($p_pagetype == 3 || $p_pictype == 0) { $strSet .= "p_picstart='" . $p_picstart . "',p_picend='" . $p_picend . "',"; } else { $p_picstart = $row["p_picstart"]; $p_picend = $row["p_picend"]; } $strSet .= "p_lzstart='" . $p_lzstart . "',p_lzend='" . $p_lzend . "',p_timestart='" . $p_timestart . "',p_timeend='" . $p_timeend . "',p_areastart='" . $p_areastart . "',p_areaend='" . $p_areaend . "',p_classtype='" . $p_classtype . "',p_collect_type='" . $p_collect_type . "',p_typestart='" . $p_typestart . "',p_typeend='" . $p_typeend . "',p_contentstart='" . $p_contentstart . "',p_contentend='" . $p_contentend . "',p_playcodetype='" . $p_playcodetype . "',p_playcodestart='" . $p_playcodestart . "',p_playcodeend='" . $p_playcodeend . "',p_playurlstart='" . $p_playurlstart . "',p_playurlend='" . $p_playurlend . "',p_playlinktype='" . $p_playlinktype . "',p_playlinkstart='" . $p_playlinkstart . "',p_playlinkend='" . $p_playlinkend . "',p_playspecialtype='" . $p_playspecialtype . "',p_playspecialrrul='" . $p_playspecialrrul . "',p_playspecialrerul='" . $p_playspecialrerul . "',p_lzcodetype='" . $p_lzcodetype . "',p_lzcodestart='" . $p_lzcodestart . "',p_lzcodeend='" . $p_lzcodeend . "',p_languagestart='" . $p_languagestart . "',p_languageend='" . $p_languageend . "',p_remarksstart='" . $p_remarksstart . "',p_remarksend='" . $p_remarksend . "',p_directedstart='" . $p_directedstart . "',p_directedend='" . $p_directedend . "',p_setnametype='" . $p_setnametype . "',p_setnamestart='" . $p_setnamestart . "',p_setnameend='" . $p_setnameend . "'"; $strSet = $strSet . ",p_playcodeApiUrl='" . $playcodeApiUrl . "',p_playcodeApiUrltype='" . $playcodeApiUrltype . "',p_playcodeApiUrlParamend='" . $p_playcodeApiUrlParamend . "',p_playcodeApiUrlParamstart='" . $playcodeApiUrlParamstart . "'"; $strSet = $strSet . ",p_videocodeApiUrl='" . $p_videocodeApiUrl . "',p_videocodeApiUrlParamstart='" . $p_videocodeApiUrlParamstart . "',p_videocodeApiUrlParamend='" . $p_videocodeApiUrlParamend . "',p_videourlstart='" . $p_videourlstart . "',p_videourlend='" . $p_videourlend . "',p_videocodeType='" . $p_videocodeType . "'"; $db->query("update {pre}cj_vod_projects set " . $strSet . " where p_id=" . $p_id); $p_listcodestart = $row["p_listcodestart"]; $p_listcodeend = $row["p_listcodeend"]; $p_listlinkstart = $row["p_listlinkstart"]; $p_listlinkend = $row["p_listlinkend"]; $p_playcodestart = $row["p_playcodestart"]; $p_playcodeend = $row["p_playcodeend"]; $p_pagebatchurl = $row["p_pagebatchurl"]; $p_pagebatchid1 = $row["p_pagebatchid1"]; $p_pagebatchid2 = $row["p_pagebatchid2"]; $p_server = $row["p_server"]; $UrlTestMoive = ''; if ($p_server > 0) { $p_server_address = $db->getOne("select ds_url from {pre}vod_server where ds_id=" . $p_server); } $p_script = $row["p_script"]; // echo $p_pagetype; if ($p_pagetype != 3) { if (isN($_SESSION["strListCode"])) { $strListCode = getPage($strlisturl, $p_coding); $_SESSION["strListCode"] = $strListCode; } else { $strListCode = $_SESSION["strListCode"]; } if (isN($_SESSION["strListCodeCut"])) { $strListCodeCut = getBody($strListCode, $p_listcodestart, $p_listcodeend); $_SESSION["strListCodeCut"] = $strListCodeCut; } else { $strListCodeCut = $_SESSION["strListCodeCut"]; } if (isN($_SESSION["linkarrcode"])) { $linkarrcode = getArray($strListCodeCut, $p_listlinkstart, $p_listlinkend); $_SESSION["linkarrcode"] = $linkarrcode; } else { $linkarrcode = $_SESSION["linkarrcode"]; } if ($p_starringtype == 1) { $starringarrcode = getArray($strListCodeCut, $p_starringstart, $p_starringend); } if ($p_titletype == 1) { $titlearrcode = getArray($strListCodeCut, $p_titlestart, $p_titleend); } if ($p_pictype == 1) { $picarrcode = getArray($strListCodeCut, $p_picstart, $p_picend); } switch ($linkarrcode) { case False: errmsg("采集提示", "<li>在获取链接列表时出错。" . $linkarrcode . "</li>"); break; default: $linkarr = explode("{Array}", $linkarrcode); $UrlTest = getHrefFromLink($linkarr[0]); $UrlTest = definiteUrl($UrlTest, $strlisturl); // var_dump($UrlTest); $linkcode = getPage($UrlTest, $p_coding); $UrlTestMoive = $UrlTest; echo "<li>采集提示:采集页面:" . $UrlTest . "</li>"; break; } } else { $strlisturl = $p_pagebatchurl; $p_pagebatchurl = replaceStr($p_pagebatchurl, "{ID}", $p_pagebatchid1); $linkcode = getPage($p_pagebatchurl, $p_coding); } var_dump($p_playtype); if ($linkcode == False) { errmsg("采集提示", "获取内容页失败!"); return; } if ($p_titletype == 1) { switch ($titlearrcode) { case False: $titlecode = "获取失败"; break; default: $titlearr = explode("{Array}", $titlearrcode); $titlecode = $titlearr[0]; break; } } else { $titlecode = getBody($linkcode, $p_titlestart, $p_titleend); writetofile("tte.log", $linkcode); var_dump(ascii_decode($titlecode)); } if ($p_starringtype == 1) { switch ($starringarrcode) { case False: $starringcode = "获取失败"; break; default: $starringarr = explode("{Array}", $starringarrcode); $starringcode = $starringarr[0]; break; } } else { $starringcode = getBody($linkcode, $p_starringstart, $p_starringend); } if ($p_pictype == 1) { switch ($picarrcode) { case False: $piccode = "获取失败"; break; default: $picarr = explode("{Array}", $picarrcode); $piccode = $picarr[0]; break; } } else { $piccode = getBody($linkcode, $p_picstart, $p_picend); } $piccode = definiteUrl($piccode, $strlisturl); if ($p_lzcodetype == 1) { $lzfwcode = getBody($linkcode, $p_lzcodestart, $p_lzcodeend); $lzcode = getBody($lzfwcode, $p_lzstart, $p_lzend); $lzcode = replaceStr($lzcode, "False", "0"); } else { $lzcode = getBody($linkcode, $p_lzstart, $p_lzend); $lzcode = replaceStr($lzcode, "False", "0"); } $remarkscode = getBody($linkcode, $p_remarksstart, $p_remarksend); $remarkscode = replaceStr($remarkscode, "False", ""); $directedcode = getBody($linkcode, $p_directedstart, $p_directedend); $directedcode = replaceStr($directedcode, "False", ""); $languagecode = getBody($linkcode, $p_languagestart, $p_languageend); $languagecode = replaceStr($languagecode, "False", "未知"); $areacode = getBody($linkcode, $p_areastart, $p_areaend); if ($areacode == false) { $areacode = "未知"; } $timecode = getBody($linkcode, $p_timestart, $p_timeend); if ($timecode == false) { $timecode = date('Y-m-d', time()); } $contentcode = getBody($linkcode, $p_contentstart, $p_contentend); if ($contentcode == false) { $contentcode = "未知"; } $contentcode = replaceFilters($contentcode, $p_id, 2, 0); if ($p_classtype == 1) { $typecode = getBody($linkcode, $p_typestart, $p_typeend); } else { $typecode = $p_collect_type; $typearr = getValueByArray($cache[0], "t_id", $typecode); $typecode = $typearr["t_name"]; } if ($p_playcodetype == 1) { $playcode = getBody($linkcode, $p_playcodestart, $p_playcodeend); if ($p_playlinktype > 0) { $weburl = getArray($playcode, $p_playlinkstart, $p_playlinkend); } else { $weburl = getArray($playcode, $p_playurlstart, $p_playurlend); // var_dump($playcode); } if ($p_setnametype == 3) { $setnames = getArray($playcode, $p_setnamestart, $p_setnameend); } } else { if ($p_playcodetype == 2) { //from api // writetofile("d:\\s.txt",$linkcode) ; // echo $p_playcodeApiUrlParamend .'=='.$playcodeApiUrlParamstart; // echo $playcodeApiUrlParamstart .'\n' .$p_playcodeApiUrlParamend .' = '.$playcodeApiUrltype; if ($playcodeApiUrltype == 0) { $paracode = getBody($linkcode, $playcodeApiUrlParamstart, $p_playcodeApiUrlParamend); } else { $paracode = getBody($UrlTestMoive, $playcodeApiUrlParamstart, $p_playcodeApiUrlParamend); } // echo $paracode; $p_apibatchurl = replaceStr($playcodeApiUrl, "{PROD_ID}", $paracode); $p_apibatchurls = replaceStr($p_apibatchurl, "{PAGE_NO}", 1); // writetofile("d:\\ts.txt", $p_apibatchurls."\n"); $playcode = getFormatPage($p_apibatchurls, $p_coding); // echo $playcode."\n"; $weburl = getArray($playcode, $p_playlinkstart, $p_playlinkend); // writetofile("d:\\ts.txt",'aaaaa('.$p_playlinkstart.")\n\t(".$p_playlinkend.")\n\t"); $page_num = 2; // writetofile("d:\\ts.txt",$weburl); // echo "page 1 :".$weburl .'\n'; $flag = true; while ($flag && strpos($playcodeApiUrl, "{PAGE_NO}") !== false) { $p_apibatchurls = replaceStr($p_apibatchurl, "{PAGE_NO}", $page_num); // echo $p_apibatchurls .'\n'; $playcode = getFormatPage($p_apibatchurls, $p_coding); $weburls = getArray($playcode, $p_playlinkstart, $p_playlinkend); // writetofile("d:\\ts.txt", "page ".$page_num." :".$weburls .'\n'); if ($weburls) { $weburl = $weburl . "{Array}" . $weburls; $page_num = $page_num + 1; } else { $flag = false; } } // var_dump($weburl); // if ($p_playlinktype >0) { // $weburl = getArray($playcode,$p_playlinkstart,$p_playlinkend); // } // else{ // $weburl = getArray($playcode,$p_playurlstart,$p_playurlend); // // var_dump($playcode); // } // if ($p_setnametype == 3) { // $setnames = getArray($playcode,$p_setnamestart,$p_setnameend); // } } else { if ($p_playlinktype > 0) { $weburl = getArray($linkcode, $p_playlinkstart, $p_playlinkend); } else { $weburl = getArray($linkcode, $p_playurlstart, $p_playurlend); } if ($p_setnametype == 3) { $setnames = getArray($linkcode, $p_setnamestart, $p_setnameend); } } } $titlecode = filterScript($titlecode, $p_script); $titlecode = replaceFilters($titlecode, $p_id, 1, 0); $starringcode = filterScriptStar($starringcode, $p_script); $directedcode = filterScriptStar($directedcode, $p_script); $timecode = filterScript($timecode, $p_script); $typecode = filterScript($typecode, $p_script); $areacode = filterScript($areacode, $p_script); $piccode = filterScript($piccode, $p_script); $remarkscode = filterScript($remarkscode, $p_script); $languagecode = filterScript($languagecode, $p_script); ?> <form name="form" action="?action=saveok" method="post"> <table class="tb"> <tr> <td colspan="2" align="center">采 集 测 试 结 果</td> </tr> <tr> <td width="20%">名称:</td> <td> <?php echo $titlecode; ?> 连载:<?php echo $lzcode; ?> 备注:<?php echo $remarkscode; ?> </td> </tr> <tr> <td>演员:</td> <td> <?php echo $starringcode; ?> </td> </tr> <tr> <td>导演:</td> <td> <?php echo $directedcode; ?> </td> </tr> <tr> <td>日期:</td> <td> <?php echo $timecode; ?> </td> </tr> <tr> <td>栏目:</td> <td> <?php echo $typecode; ?> </td> </tr> <tr> <td>地区:</td> <td> <?php echo $areacode; ?> </td> </tr> <tr> <td>语言:</td> <td> <?php echo $languagecode; ?> </td> </tr> <tr> <td>图片:</td> <td> <?php echo getHrefFromImg($piccode); ?> </td> </tr> <tr> <td>介绍:</td> <td> <?php echo strip_tags($contentcode); ?> </td> </tr> <?php if ($weburl != False) { $webArray = explode("{Array}", $weburl); $setnamesArray = explode("{Array}", $setnames); $webArraTemp = array(); $index = 0; $webUrls = ''; for ($i = 0; $i < count($webArray); $i++) { $UrlTemp = $webArray[$i]; if (strpos($webUrls, $UrlTemp . '<array>') === false) { $webArraTemp[$index] = $UrlTemp; $webUrls = $webUrls . $UrlTemp . '<array>'; $index++; } } $webArray = $webArraTemp; for ($i = 0; $i < count($webArray); $i++) { $UrlTest = $webArray[$i]; if ($p_playspecialtype == 1 && strpos("," . $p_playspecialrrul, "[变量]")) { $Keyurl = explode("[变量]", $p_playspecialrrul); $urli = getBody($UrlTest, $Keyurl[0], $Keyurl[1]); if ($urli == False) { break; } $UrlTest = replaceStr($p_playspecialrerul, "[变量]", $urli); } if ($p_playspecialtype == 2) { $urArray = explode("/", $UrlTestMoive); // writetofile("d:\\ts.txt","ss:".$UrlTestMoive); $ur = ""; for ($k = 0; $k < count($urArray) - 1; $k++) { $ur = $ur . $urArray[$k] . "/"; } $UrlTest = $ur . $UrlTest . ".html"; } // writetofile("d:\\ts.txt", $UrlTest); if ($p_playlinktype == 1) { $UrlTest = getHrefFromLink($UrlTest); $UrlTest = definiteUrl($UrlTest, $strlisturl); $webCode = getPage($UrlTest, $p_coding); $url = getBody($webCode, $p_playurlstart, $p_playurlend); $url = replaceFilters($url, $p_id, 3, 0); $url = replaceLine($url); $androidUrl = ContentProviderFactory::getContentProvider($p_playtype)->parseAndroidVideoUrlByContent($webCode, $p_coding, $p_script); $videoAddressUrl = ContentProviderFactory::getContentProvider($p_playtype)->parseIOSVideoUrlByContent($webCode, $p_coding, $p_script); $videoAddressUrl = $androidUrl . '{====}' . $videoAddressUrl; } else { if ($p_playlinktype == 2) { $UrlTest = getHrefFromLink($UrlTest); if (isN($p_playurlend)) { $tmpA = strpos($UrlTest, $p_playurlstart); $url = substr($UrlTest, strlen($UrlTest) - $tmpA - strlen($p_playurlstart) + 1); } else { $url = getBody($UrlTest, $p_playurlstart, $p_playurlend); } } else { if ($p_playlinktype == 3) { $UrlTest = getHrefFromLink($UrlTest); $UrlTest = definiteUrl($UrlTest, $strlisturl); $webCode = getPage($UrlTest, $p_coding); $tmpB = getArray($webCode, $p_playurlstart, $p_playurlend); $tmpC = explode("{$Array}\$", $tmpB); foreach ($tmpC as $tmpD) { $url = $tmpD; ?> <tr> <td>播放列表:</td> <td> <?php echo $p_server_address . $UrlTest; ?> </td> </tr> <tr> <td>地址:</td> <td> <?php echo $p_server_address . $url; ?> </td> </tr> <?php } break; } else { $url = replaceFilters($UrlTest, $p_id, 3, 0); $url = replaceLine($url); // echo $url; $webCode = getPage($UrlTestMoive, $p_coding); $androidUrl = ContentProviderFactory::getContentProvider($p_playtype)->parseAndroidVideoUrlByContent($webCode, $p_coding, $p_script); $videoAddressUrl = ContentProviderFactory::getContentProvider($p_playtype)->parseIOSVideoUrlByContent($webCode, $p_coding, $p_script); $videoAddressUrl = $androidUrl . '{====}' . $videoAddressUrl; ?> <tr> <td>播放列表:</td> <td> <?php echo $p_server_address . $UrlTestMoive; ?> </td> </tr> <tr> <td>视频地址列表:</td> <td> <?php echo $p_server_address . replaceStr($videoAddressUrl, "\\", ""); ?> </td> </tr> <tr> <td>地址:</td> <td> <?php echo $p_server_address . $url; ?> </td> </tr> <?php continue; } } } if ($p_setnametype == 1) { $setname = getBody($url, $p_setnamestart, $p_setnameend); // $url = $setname ."$" .$url; } else { if ($p_setnametype == 2 && $p_playlinktype == 1) { $setname = getBody($webCode, $p_setnamestart, $p_setnameend); // $url = $setname ."$" .$url; } else { if ($p_setnametype == 3) { $setname = $setnamesArray[$i]; // $url = $setnamesArray[$i] . "$" .$url; } } } ?> <tr> <td>播放列表:</td> <td> <?php echo $UrlTest; ?> </td> </tr><tr> <td>视频地址列表:</td> <td> <?php echo $p_server_address . replaceStr($videoAddressUrl, "\\", ""); ?> </td> </tr> <tr> <td>地址:</td> <td> <?php echo $url; ?> 集数: <?php echo filterScriptStar($setname, $p_script); ?> </td> </tr> <?php } } ?> <tr> <td colspan="2"><input name="button" type="button" class="btn" id="button" onClick="window.location.href='javascript:history.go(-1)'" value="上一步"> <input name="Submit" type="submit" class="btn" id="Submit" value="完 成"></td> </tr> </table> </form> <?php }
public function getCommentsByUrl($url) { $content = getPage($url, "utf-8"); if (isset($content) && !is_null($content)) { // echo $content; $content = getBodys($content, AutoDouBanParseScore::COMMENT_CONTENT_START); $dates = getArray($content, AutoDouBanParseScore::DATE_START, AutoDouBanParseScore::DATE_END); $coments = getArray($content, AutoDouBanParseScore::CONTENT_START, AutoDouBanParseScore::CONTENT_END); $coments = replaceStr($coments, """, "\""); $USERS = getArray($content, AutoDouBanParseScore::USERS_START, AutoDouBanParseScore::USERS_END); $USERS = filterScriptStar($USERS, '8191'); $USERS = replaceStr($USERS, ",", ""); // var_dump($USERS);var_dump($dates); if (isset($coments) && !is_null($coments)) { $coments = filterScriptStar($coments, '8191'); // var_dump($coments); return array('dates' => $dates, 'comments' => $coments, 'authors' => $USERS); } } return false; }