$des = '<font color="red">数据已经锁定,跳过。</font>'; } else { if ($ct == "1") { $n_from = $row["d_downfrom"]; $n_server = $row["d_downserver"]; $n_note = $row['d_downnote']; $n_url = $row["d_downurl"]; } else { $n_from = $row["d_playfrom"]; $n_server = $row["d_playserver"]; $n_note = $row['d_playnote']; $n_url = $row["d_playurl"]; } $des = ''; foreach ($array4[1] as $key => $value) { $d_playfrom = getFrom($value); $d_playurl = getVUrl($array4[2][$key]); $rc = false; if ($n_url == $d_playurl) { $des .= '<font color="red">地址相同,跳过。</font>'; continue; } elseif (isN($d_playfrom)) { $des .= '<font color="red">播放器类型为空,跳过。</font>'; continue; } elseif (strpos("," . $n_from, $d_playfrom) <= 0) { $rc = true; $des .= '<font color="green">播放组(' . $d_playfrom . '),新增。</font>'; $n_url .= "\$\$\$" . $d_playurl; $n_from .= "\$\$\$" . $d_playfrom; $n_server .= "\$\$\$" . $d_playserver; $n_note .= "\$\$\$" . $d_playnote;
if ($f == false) { $UI->loadPage('invalidLink'); } global $onItemID, $onNews; $UI->loadPage('formpostcomment'); } elseif ($selectedModule == 'postcomment') { $f = getFrom('post', array('subject', 'message'), $infoArrayUser, array(), array('subject', 'message')); if ($f !== true) { $UI->setRunning(true); foreach ($f as $e) { trigger_error($UI->i10nMan->translate('You need to fill in %s', $this->i10nMan->translate($e))); } $UI->setRunning(false); $UI->loadPage('index'); } else { $f = getFrom('post', array('onitem_number', 'onnews'), $infoArrayNews); if ($f !== true) { $UI->loadPage('invalidLink'); } else { $user = $UI->getUserClass(); $userInfo = $user->getUser(); $userID = $userInfo['username']; $language = $userInfo['contentlanguage']; $UI->setRunning(true); $result = $UI->news->addComment($infoArrayUser['subject'], $infoArrayUser['message'], $language, $infoArrayNews['onnews'], $infoArrayNews['onitem_number'], $userID); if ($result == true) { trigger_error('NOTICE: ' . $UI->i10nMan->translate('Your comment is successfully posted.')); } else { trigger_error('ERROR: ' . $UI->i10nMan->translate('Your comment is not posted.')); } $UI->setRunning(false);
function cj() { global $MAC, $bindcache, $backurl, $typearr, $ac2, $apiurl, $flag, $xt, $ct, $group, $wd, $type, $pg, $hour, $db; switch ($ac2) { case 'sel': $ids = be("arr", "ids"); if (empty($ids)) { errMsg("采集提示", "请选择采集数据"); } switch ($xt) { case '1': $url = "?ac=videolist&rid=" . $group . "&ids=" . $ids; break; case '2': $url = "-action-ids-vodids-" . $ids . "-cid--play--inputer--wd--h-0-p-1"; break; } break; case 'day': switch ($xt) { case '1': $url = "?ac=videolist&rid=" . $group . "&h=" . $hour . "&pg=" . $pg; break; case '2': $url = "-action-day-vodids--cid--play--inputer--wd--h-" . $hour . "-p-" . $pg; break; } break; case 'type': if (empty($type)) { errMsg("请先进入分类,否则无法使用采集分类!"); } switch ($xt) { case '1': $url = "?ac=videolist&rid=" . $group . "&pg=" . $pg . "&t=" . $type; break; case '2': $url = "-action-all-vodids--cid-" . $type . "-play--inputer--wd--h-0-p-" . $pg; break; } break; case 'all': switch ($xt) { case '1': $url = "?ac=videolist&rid=" . $group . "&pg=" . $pg; break; case '2': $url = "-action-all-vodids--cid--play--inputer--wd--h-0-p-" . $pg; break; } break; } $url = $apiurl . $url; if ($xt == "0") { $xn_list = '/<pagecount>([0-9]+)<\\/pagecount>/'; $xn_pagesize = 1; $xn_pagecount = 1; $xn_recordcount = 1; $xn_d = '/<vod><id>([0-9]+)<\\/id><name><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/name><note><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/note><state>([\\s\\S]*?)<\\/state><type>([\\s\\S]*?)<\\/type><starring><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/starring><directed><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/directed><pic>([\\s\\S]*?)<\\/pic><time>([\\s\\S]*?)<\\/time><year>([\\s\\S]*?)<\\/year><area><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/area><language><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/language><urls>([\\s\\S]*?)<\\/urls><des><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/des><\\/vod>/'; $xn_url = '/<url from="([\\s\\S]*?)"><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/url>/'; $xn_d_id = 1; $xn_d_name = 2; $xn_d_remarks = 3; $xn_d_state = 4; $xn_d_type = 5; $xn_d_starring = 6; $xn_d_directed = 7; $xn_d_pic = 8; $xn_d_time = 9; $xn_d_year = 10; $xn_d_area = 11; $xn_d_lang = 12; $xn_d_des = 14; $xn_d_urls = 13; } elseif ($xt == "1") { $xn_list = '<list page="([\\s\\S]*?)" pagecount="([0-9]+)" pagesize="([0-9]+)" recordcount="([0-9]+)">'; $xn_pagesize = 3; $xn_pagecount = 2; $xn_recordcount = 4; $xn_d = '/<video><last>([\\s\\S]*?)<\\/last><id>([0-9]+)<\\/id><tid>([0-9]+)<\\/tid><name><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/name><type>([\\s\\S]*?)<\\/type><pic>([\\s\\S]*?)<\\/pic><lang>([\\s\\S]*?)<\\/lang><area>([\\s\\S]*?)<\\/area><year>([\\s\\S]*?)<\\/year><state>([\\s\\S]*?)<\\/state><note><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/note><actor><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/actor><director><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/director><dl>([\\s\\S]*?)<\\/dl><des><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/des>([\\s\\S]*?)<\\/video>/'; $xn_url = '/<dd flag="([\\s\\S]*?)"><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/dd>/'; $xn_d_time = 1; $xn_d_id = 2; $xn_d_type = 3; $xn_d_name = 4; $xn_d_pic = 6; $xn_d_lang = 7; $xn_d_area = 8; $xn_d_year = 9; $xn_d_state = 10; $xn_d_remarks = 11; $xn_d_starring = 12; $xn_d_directed = 13; $xn_d_urls = 14; $xn_d_content = 15; } elseif ($xt == "2") { $url = str_replace('|', '-', $url); $xn_list = '<list page="([\\s\\S]*?)" pagecount="([0-9]+)" pagesize="([0-9]+)" recordcount="([0-9]+)">'; $xn_pagesize = 3; $xn_pagecount = 2; $xn_recordcount = 4; $xn_d = '/<video><last>([\\s\\S]*?)<\\/last><id>([0-9]+)<\\/id><tid>([0-9]+)<\\/tid><name><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/name><type>([\\s\\S]*?)<\\/type><pic>([\\s\\S]*?)<\\/pic><lang>([\\s\\S]*?)<\\/lang><area>([\\s\\S]*?)<\\/area><year>([\\s\\S]*?)<\\/year><state>([\\s\\S]*?)<\\/state><note><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/note><actor><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/actor><director><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/director><dl>([\\s\\S]*?)<\\/dl><des><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/des>([\\s\\S]*?)<\\/video>/'; $xn_url = '/<dd flag="([\\s\\S]*?)"><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/dd>/'; $xn_d_time = 1; $xn_d_id = 2; $xn_d_type = 3; $xn_d_name = 4; $xn_d_pic = 6; $xn_d_lang = 7; $xn_d_area = 8; $xn_d_year = 9; $xn_d_state = 10; $xn_d_remarks = 11; $xn_d_starring = 12; $xn_d_directed = 13; $xn_d_urls = 14; $xn_d_content = 15; } $html = getPage($url, "utf-8"); preg_match($xn_list, $html, $array1); $pgsize = $array1[$xn_pagesize]; $pgcount = $array1[$xn_pagecount]; $recordcount = $array1[$xn_recordcount]; unset($array1); if (count($recordcount) == 0) { echo '没有任何可用数据' . jump('?m=collect-list-xt-' . $xt . "-ct-" . $ct . '-group-' . $group . '-flag-' . $flag . '-apiurl-' . $apiurl, 1); return; } echo '当前采集任务<strong class="green">' . $pg . '</strong>/<span class="green">' . $pgcount . '</span>页 采集地址 ' . $url; ob_flush(); flush(); $inrule = $MAC['collect']['vod']['inrule']; $uprule = $MAC['collect']['vod']['uprule']; $filter = $MAC['collect']['vod']['filter']; preg_match_all($xn_d, $html, $array3); $i = 0; foreach ($array3[1] as $key => $value) { $i++; $rc = false; $d_id = $array3[$xn_d_id][$key]; $d_name = format_vodname($array3[$xn_d_name][$key]); $d_remarks = $array3[$xn_d_remarks][$key]; $d_state = intval($array3[$xn_d_state][$key]); $d_type = intval($bindcache[$flag . $array3[$xn_d_type][$key]]); $d_starring = htmlspecialchars_decode($array3[$xn_d_starring][$key]); $d_directed = htmlspecialchars_decode($array3[$xn_d_directed][$key]); $d_pic = $array3[$xn_d_pic][$key]; $d_time = $array3[$xn_d_time][$key]; $d_year = intval($array3[$xn_d_year][$key]); $d_area = $array3[$xn_d_area][$key]; $d_lang = $array3[$xn_d_lang][$key]; $d_content = htmlspecialchars_decode($array3[$xn_d_content][$key]); $d_playurls = htmlspecialchars_decode($array3[$xn_d_urls][$key]); $d_playurls = str_replace("'", "''", $d_playurls); preg_match_all($xn_url, $d_playurls, $array4); $d_enname = Hanzi2PinYin($d_name); $d_letter = strtoupper(substring($d_enname, 1)); $d_addtime = time(); $d_time = $d_addtime; $d_hitstime = ""; $d_hits = rand($MAC['collect']['vod']['hitsstart'], $MAC['collect']['vod']['hitsend']); $d_dayhits = rand($MAC['collect']['vod']['hitsstart'], $MAC['collect']['vod']['hitsend']); $d_weekhits = rand($MAC['collect']['vod']['hitsstart'], $MAC['collect']['vod']['hitsend']); $d_monthhits = rand($MAC['collect']['vod']['hitsstart'], $MAC['collect']['vod']['hitsend']); $d_score = 0; $d_scoreall = 0; $d_scorenum = 0; if ($MAC['collect']['vod']['score'] == 1) { $d_scorenum = rand(1, 500); $d_scoreall = $d_scorenum * rand(1, 10); $d_score = round($d_scoreall / $d_scorenum, 1); } $d_hide = $MAC['collect']['vod']['hide']; if ($MAC['collect']['vod']['psernd'] == 1) { $d_content = repPseRnd('vod', $d_content, $i); } if ($MAC['collect']['vod']['psesyn'] == 1) { $d_content = repPseSyn('vod', $d_content); } $d_downfrom = ''; $d_downserver = ''; $d_downnote = ''; $d_downurl = ''; $d_playfrom = ''; $d_playserver = ''; $d_playnote = ''; $d_playurl = ''; $d_tag = ''; $color = 'red'; $msg = ''; if ($d_type < 1) { $des = "分类未绑定,系统跳过采集。"; } elseif (empty($d_name)) { $des = "数据不完整,不进行处理。"; } elseif (strpos(',' . $filter, $d_name)) { $des = "数据在过滤单中,系统跳过采集。"; } else { $sql = "SELECT * FROM {pre}vod WHERE d_name ='" . $d_name . "' "; if (strpos($inrule, 'b')) { $sql .= ' and d_type=' . $d_type; } if (strpos($inrule, 'c')) { $sql .= ' and d_year=' . $d_year; } if (strpos($inrule, 'd')) { $sql .= ' and d_area=\'' . $d_area . '\''; } if (strpos($inrule, 'e')) { $sql .= ' and d_lang=\'' . $d_lang . '\''; } if (strpos($inrule, 'f')) { $sql .= ' and d_starring=\'' . $d_starring . '\''; } if (strpos($inrule, 'g')) { $sql .= ' and d_directed=\'' . $d_directed . '\''; } if ($MAC['collect']['vod']['tag'] == 1) { $d_tag = getTag($d_name, $d_content); } $row = $db->getRow($sql); if (!$row) { foreach ($array4[1] as $key => $value) { if ($rc) { $d_playfrom .= "\$\$\$"; $d_playserver .= "\$\$\$"; $d_playnote .= "\$\$\$"; $d_playurl .= "\$\$\$"; } $d_playfrom .= getFrom($value); if ($xt == "1") { $d_playurl .= getVUrl($array4[2][$key]); } else { $d_playurl .= $array4[2][$key]; } $d_playserver .= '0'; $d_playnote .= ''; $rc = true; } if ($MAC['collect']['vod']['pic'] == 1) { $st = strrpos($d_pic, '/'); $fname = substring($d_pic, strlen($d_pic) - $st, $st + 1); $path = "upload/vod/" . getSavePicPath('') . "/"; $thumbpath = "upload/vodthumb/" . getSavePicPath('vodthumb') . "/"; $ps = savepic($d_pic, $path, $thumbpath, $fname, 'vod', $msg); if ($ps) { $d_pic = $path . $fname; $d_picthumb = $thumbpath . $fname; } } if ($ct == "1") { $d_downfrom = $d_playfrom; $d_downserver = ""; $d_downnote = ""; $d_downurl = $d_playurl; $d_playfrom = ""; $d_playserver = ""; $d_playnote = ""; $d_playurl = ""; } else { $d_playserver = ""; $d_downfrom = ""; $d_downserver = ""; $d_downnote = ""; $d_downurl = ""; } $db->Add("{pre}vod", array("d_type", "d_name", "d_enname", "d_letter", "d_state", "d_remarks", "d_tag", "d_pic", 'd_picthumb', "d_hits", "d_dayhits", "d_weekhits", "d_monthhits", "d_score", "d_scoreall", "d_scorenum", "d_starring", "d_directed", "d_year", "d_area", "d_lang", "d_addtime", "d_time", "d_hide", "d_content", "d_playfrom", "d_playserver", "d_playnote", "d_playurl", "d_downfrom", "d_downserver", "d_downnote", "d_downurl"), array($d_type, $d_name, $d_enname, $d_letter, $d_state, $d_remarks, $d_tag, $d_pic, $d_picthumb, $d_hits, $d_dayhits, $d_weekhits, $d_monthhits, $d_score, $d_scoreall, $d_scorenum, $d_starring, $d_directed, $d_year, $d_area, $d_lang, $d_addtime, $d_time, $d_hide, $d_content, $d_playfrom, $d_playserver, $d_playnote, $d_playurl, $d_downfrom, $d_downserver, $d_downnote, $d_downurl)); $color = 'green'; $des = "无重名,新加入库成功。"; } else { if ($row['d_lock'] == 1) { $des = "数据已经锁定,系统跳过采集更新。"; } else { if ($ct == "1") { $n_from = $row["d_downfrom"]; $n_server = $row["d_downserver"]; $n_note = $row['d_downnote']; $n_url = $row["d_downurl"]; } else { $n_from = $row["d_playfrom"]; $n_server = $row["d_playserver"]; $n_note = $row['d_playnote']; $n_url = $row["d_playurl"]; } $color = 'red'; foreach ($array4[1] as $key => $value) { $d_playfrom = getFrom($value); $d_playserver = '0'; if ($xt == "1") { $d_playurl = getVUrl($array4[2][$key]); } else { $d_playurl = $array4[2][$key]; } $rc = false; if ($n_url == $d_playurl) { $des = "数据相同,暂不更新数据"; continue; } elseif (isN($d_playfrom)) { $des = "播放器类型为空,跳过组合播放地址"; continue; } elseif (strpos("," . $n_from, $d_playfrom) <= 0) { $rc = true; $color = 'green'; $des = "数据发生改变,新增播放组。"; $n_url .= "\$\$\$" . $d_playurl; $n_from .= "\$\$\$" . $d_playfrom; $n_server .= "\$\$\$" . $d_playserver; $n_note .= "\$\$\$" . $d_playnote; } else { $color = 'green'; $des = "数据发生改变,更新播放组。"; $arr1 = explode("\$\$\$", $n_url); $arr2 = explode("\$\$\$", $n_from); $n_url = ""; for ($k = 0; $k < count($arr2); $k++) { if ($rc) { $n_url .= "\$\$\$"; } if (count($arr1) >= $k) { if ($arr2[$k] == $d_playfrom) { $arr1[$k] = $d_playurl; } $n_url .= $arr1[$k]; } else { $n_url .= $d_playurl; } $rc = true; } } } if ($rc) { $colarr = array(); $valarr = array(); array_push($colarr, 'd_time'); array_push($valarr, time()); if (strpos(',' . $uprule, 'a') && $ct != 1) { array_push($colarr, 'd_playfrom', 'd_playserver', 'd_playnote', 'd_playurl'); array_push($valarr, $n_from, $n_server, $n_note, $n_url); } if (strpos(',' . $uprule, 'b') && $ct == 1) { array_push($colarr, 'd_downfrom', 'd_downserver', 'd_downnote', 'd_downurl'); array_push($valarr, $n_from, $n_server, $n_note, $n_url); } if (strpos(',' . $uprule, 'c')) { array_push($colarr, 'd_state'); array_push($valarr, $d_state); } if (strpos(',' . $uprule, 'd')) { array_push($colarr, 'd_remarks'); array_push($valarr, $d_remarks); } if (strpos(',' . $uprule, 'e')) { array_push($colarr, 'd_directed'); array_push($valarr, $d_directed); } if (strpos(',' . $uprule, 'f')) { array_push($colarr, 'd_starring'); array_push($valarr, $d_starring); } if (strpos(',' . $uprule, 'g')) { array_push($colarr, 'd_year'); array_push($valarr, $d_year); } if (strpos(',' . $uprule, 'h')) { array_push($colarr, 'd_area'); array_push($valarr, $d_area); } if (strpos(',' . $uprule, 'i')) { array_push($colarr, 'd_lang'); array_push($valarr, $d_lang); } if (strpos(',' . $uprule, 'j')) { if ($MAC['collect']['vod']['pic'] == 1) { $st = strrpos($d_pic, '/'); $fname = substring($d_pic, strlen($d_pic) - $st, $st + 1); $path = "upload/vod/" . getSavePicPath('') . "/"; $thumbpath = "upload/vodthumb/" . getSavePicPath('vodthumb') . "/"; $ps = savepic($d_pic, $path, $thumbpath, $fname, 'vod', $msg); if ($ps) { $d_pic = $path . $fname; $d_picthumb = $thumbpath . $fname; array_push($colarr, 'd_pic'); array_push($valarr, $d_pic); array_push($colarr, 'd_picthumb'); array_push($valarr, $d_picthumb); } } } if (strpos(',' . $uprule, 'k')) { array_push($colarr, 'd_content'); array_push($valarr, $d_content); } if (strpos(',' . $uprule, 'l')) { array_push($colarr, 'd_tag'); array_push($valarr, $d_tag); } if (count($colarr) > 0) { $db->Update("{pre}vod", $colarr, $valarr, "d_id=" . $row["d_id"]); } } } } unset($row); unset($array4); } //echo <<<EOT //<div>$i. $d_name <font color="$color"> $des</font> $msg </div> //EOT; ob_flush(); flush(); } unset($array3); //unset($pinyins); if ($pg < $pgcount) { $pg = $pg + 1; cj(); } else { echo '<br>采集完毕...'; } }
function insertdata($url, $cjtype) { global $db, $action, $rtype, $rpage, $rkey, $rday, $cjurl, $xt, $cjflag, $backurl; if ($xt == "1" || $xt == "2") { $xn_vod = '/<video><last>([\\s\\S]*?)<\\/last><id>([0-9]+)<\\/id><tid>([0-9]+)<\\/tid><name><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/name><type>([\\s\\S]*?)<\\/type><pic>([\\s\\S]*?)<\\/pic><lang>([\\s\\S]*?)<\\/lang><area>([\\s\\S]*?)<\\/area><year>([\\s\\S]*?)<\\/year><state>([\\s\\S]*?)<\\/state><note><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/note><actor><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/actor><director><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/director><dl>([\\s\\S]*?)<\\/dl><des><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/des><\\/video>/'; $xn_url = '/<dd flag="([\\s\\S]*?)"><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/dd>/'; $xn_vod_time = 1; $xn_vod_id = 2; $xn_vod_name = 4; $xn_vod_type = 3; $xn_vod_pic = 6; $xn_vod_language = 7; $xn_vod_area = 8; $xn_vod_year = 9; $xn_vod_state = 10; $xn_vod_remarks = 11; $xn_vod_starring = 12; $xn_vod_directed = 13; $xn_vod_urls = 14; $xn_vod_des = 15; } else { $xn_vod = '/<vod><id>([0-9]+)<\\/id><name><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/name><note><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/note><state>([\\s\\S]*?)<\\/state><type>([\\s\\S]*?)<\\/type><starring><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/starring><directed><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/directed><pic>([\\s\\S]*?)<\\/pic><time>([\\s\\S]*?)<\\/time><year>([\\s\\S]*?)<\\/year><area><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/area><language><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/language><urls>([\\s\\S]*?)<\\/urls><des><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/des><\\/vod>/'; $xn_url = '/<url from="([\\s\\S]*?)"><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/url>/'; $xn_vod_id = 1; $xn_vod_name = 2; $xn_vod_remarks = 3; $xn_vod_state = 4; $xn_vod_type = 5; $xn_vod_starring = 6; $xn_vod_directed = 7; $xn_vod_pic = 8; $xn_vod_time = 9; $xn_vod_year = 10; $xn_vod_area = 11; $xn_vod_language = 12; $xn_vod_des = 14; $xn_vod_urls = 13; } $html = getPage($url, "utf-8"); if (html == false) { echo "err获取数据失败,请点击我重试"; exit; } if ($xt == "1" || $xt == "2") { $pagecount = intval(getBody($html, "pagecount=\"", "\" pagesize")); } else { $pagecount = intval(getBody($html, "<pagecount>", "</pagecount>")); } if ($pagecount == 0) { echo "err没有任何可用数据"; exit; } preg_match_all($xn_vod, $html, $array3); $i = 0; foreach ($array3[1] as $key => $value) { $rc = false; $vodid = $array3[$xn_vod_id][$key]; $vodname = $array3[$xn_vod_name][$key]; $vodremarks = $array3[$xn_vod_remarks][$key]; $vodstate = $array3[$xn_vod_state][$key]; $vodtype = $cjflag . $array3[$xn_vod_type][$key]; $vodstarring = $array3[$xn_vod_starring][$key]; $voddirected = $array3[$xn_vod_directed][$key]; $vodpic = $array3[$xn_vod_pic][$key]; $vodtime = $array3[$xn_vod_time][$key]; $vodyear = $array3[$xn_vod_year][$key]; $vodarea = $array3[$xn_vod_area][$key]; $vodlanguage = $array3[$xn_vod_language][$key]; $voddes = $array3[$xn_vod_des][$key]; $vodurls = $array3[$xn_vod_urls][$key]; preg_match_all($xn_url, $vodurls, $array4); $vodsubname = ""; $vodcolor = ""; $vodhitstime = ""; $voddownurl = ""; $vodplayserver = "0"; $vodfrom = ""; $vodurl = ""; $vodname = replaceStr($vodname, "'", ""); if (strlen($vodname) > 255) { $vodname = substring($vodname, 255); } $vodenname = Hanzi2PinYin($vodname); if (strlen($vodenname) > 255) { $vodenname = substring($vodenname, 255); } if (!isN($vodenname)) { $vodletter = strtoupper(substring($vodenname, 1)); } $vodstate = replaceStr($vodstate, "[", ""); $vodstate = replaceStr($vodstate, "]", ""); if (!isNum($vodstate)) { $vodstate = 0; } $vodstarring = replaceStr($vodstarring, "'", ""); $vodstarring = replaceStr($vodstarring, "、", " "); $vodstarring = replaceStr($vodstarring, ",", " "); $vodstarring = replaceStr($vodstarring, ",", " "); $vodstarring = replaceStr($vodstarring, " ", " "); if (strlen($vodstarring) > 255) { $vodstarring = substring($vodstarring, 255); } $vodyear = replaceStr($vodyear, "'", ""); if (strlen($vodyear) > 32) { $vodyear = substring($vodyear, 32); } $vodlanguage = replaceStr($vodlanguage, "'", ""); if (strlen($vodlanguage) > 32) { $vodlanguage = substring($vodlanguage, 32); } $vodarea = replaceStr($vodarea, "'", ""); if (strlen($vodarea) > 32) { $vodarea = substring($vodarea, 32); } $vodpic = replaceStr($vodpic, "'", ""); if (strlen($vodpic) > 255) { $vodpic = substring($vodpic, 255); } $voddes = replaceStr($voddes, "'", ""); $vodtype = getTypeID($vodtype); if (!isNum($vodtype)) { $vodtype = 0; } if ($vodtype > 0) { $sql = "SELECT * FROM {pre}vod WHERE d_name ='" . $vodname . "' "; $row = $db->getRow($sql); if (!$row) { foreach ($array4[1] as $key => $value) { if ($rc) { $vodfrom .= "\$\$\$"; $vodurl .= "\$\$\$"; } $vodfrom .= getFrom($value); if ($xt == "1" || $xt == "2") { $vodurl .= getVUrl($array4[2][$key]); } else { $vodurl .= $array4[2][$key]; } $vodurl = replaceStr($vodurl, Chr(10), Chr(13)); if (substring($vodurl, 1, strlen($vodurl) - 1) == Chr(13)) { $vodurl = substring($vodurl, strlen($vodurl) - 1); } $vodurl = replaceStr($vodurl, Chr(13), "#"); $vodurl = replaceStr($vodurl, "##", "#"); $vodurl = replaceStr($vodurl, "'", "''"); $rc = true; } $db->Add("{pre}vod", array("d_type", "d_name", "d_subname", "d_enname", "d_letter", "d_state", "d_color", "d_content", "d_remarks", "d_pic", "d_level", "d_hits", "d_starring", "d_directed", "d_year", "d_area", "d_language", "d_addtime", "d_time", "d_playurl", "d_downurl", "d_playfrom", "d_playserver"), array($vodtype, $vodname, $vodsubname, $vodenname, $vodletter, $vodstate, $vodcolor, $voddes, $vodremarks, $vodpic, 0, 0, $vodstarring, $voddirected, $vodyear, $vodarea, $vodlanguage, date('Y-m-d H:i:s', time()), date('Y-m-d H:i:s', time()), $vodurl, $voddownurl, $vodfrom, $vodplayserver)); wTips($vodname, "新增数据"); } else { $tmpplayurl = $row["d_playurl"]; $tmpplayfrom = $row["d_playfrom"]; $tmpplayserver = $row["d_playserver"]; foreach ($array4[1] as $key => $value) { $vodfrom = getFrom($value); if ($xt == "1" || $xt == "2") { $vodurl = getVUrl($array4[2][$key]); } else { $vodurl = $array4[2][$key]; } $vodurl = replaceStr($vodurl, Chr(10), Chr(13)); if (substring($vodurl, 1, strlen($vodurl) - 1) == Chr(13)) { $vodurl = substring($vodurl, strlen($vodurl) - 1); } $vodurl = replaceStr($vodurl, Chr(13), "#"); $vodurl = replaceStr($vodurl, "##", "#"); $vodurl = replaceStr($vodurl, "'", "''"); if ($tmpplayurl == $vodurl) { $resultdes = "无需更新播放地址"; continue; } else { if (isN($vodfrom)) { wTips($vodname, "播放器类型为空,跳过"); continue; } else { if (isN($tmpplayurl) || strpos("," . $row["d_playfrom"], $vodfrom) <= 0) { $resultdes = "新增播放地址组"; $tmpplayurl .= "\$\$\$" . $vodurl; $tmpplayfrom .= "\$\$\$" . $vodfrom; $tmpplayserver .= "\$\$\$" . $vodplayserver; } else { $resultdes = "更新播放地址"; $arr1 = explode("\$\$\$", $tmpplayurl); $arr2 = explode("\$\$\$", $tmpplayfrom); $rc = false; $tmpplayurl = ""; for ($k = 0; $k < count($arr2); $k++) { if ($rc) { $tmpplayurl .= "\$\$\$"; } if ($arr2[$k] == $vodfrom) { $arr1[$k] = $vodurl; } $tmpplayurl .= $arr1[$k]; $rc = true; } } } } } $tmpplayurl = replaceStr($tmpplayurl, Chr(13), "#"); if (strpos("," . $row["d_pic"], "http:") <= 0) { $vodpic = $row["d_pic"]; } $db->Update("{pre}vod", array("d_state", "d_pic", "d_remarks", "d_time", "d_playurl", "d_playfrom", "d_playserver"), array($vodstate, $vodpic, $vodremarks, date('Y-m-d H:i:s', time()), $tmpplayurl, $tmpplayfrom, $tmpplayserver), "d_id=" . $row["d_id"]); wTips($vodname, $resultdes); } unset($row); } else { wTips($vodname, "没有绑定分类、跳过"); } unset($array4); } unset($array3); echo "ok第" . $rpage . "页完成,共" . $pagecount . "页"; if ($rpage < $pagecount) { $rpage = $rpage + 1; cjday(); } }
function insertdata($url, $cjtype) { global $db, $action, $rtype, $rpage, $rkey, $rday, $cjurl, $xt, $rid, $cjflag, $backurl; wBreakpoint("../upload/maccjbreakpoint", "admin_maccj.php?action=" . $action . "&xt=" . $xt . "&rid=" . $rid . "&cjflag=" . $cjflag . "&rpage=" . $rpage . "&rtype=" . $rtype . "&rkey=" . $rkey . "&cjurl=" . $cjurl); if ($xt == "1") { $xn_vod = '/<video><last>([\\s\\S]*?)<\\/last><id>([0-9]+)<\\/id><tid>([0-9]+)<\\/tid><name><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/name><type>([\\s\\S]*?)<\\/type><pic>([\\s\\S]*?)<\\/pic><lang>([\\s\\S]*?)<\\/lang><area>([\\s\\S]*?)<\\/area><year>([\\s\\S]*?)<\\/year><state>([\\s\\S]*?)<\\/state><note><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/note><actor><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/actor><director><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/director><dl>([\\s\\S]*?)<\\/dl><des><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/des>([\\s\\S]*?)<\\/video>/'; $xn_url = '/<dd flag="([\\s\\S]*?)"><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/dd>/'; $xn_vod_time = 1; $xn_vod_id = 2; $xn_vod_name = 4; $xn_vod_type = 3; $xn_vod_pic = 6; $xn_vod_language = 7; $xn_vod_area = 8; $xn_vod_year = 9; $xn_vod_state = 10; $xn_vod_remarks = 11; $xn_vod_starring = 12; $xn_vod_directed = 13; $xn_vod_urls = 14; $xn_vod_des = 15; } else { if ($xt == "2") { $xn_vod = '/<video><last>([\\s\\S]*?)<\\/last><id>([0-9]+)<\\/id><tid>([0-9]+)<\\/tid><name><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/name><type>([\\s\\S]*?)<\\/type><dt>([\\s\\S]*?)<\\/dt><pic>([\\s\\S]*?)<\\/pic><lang>([\\s\\S]*?)<\\/lang><area>([\\s\\S]*?)<\\/area><year>([\\s\\S]*?)<\\/year><state>([\\s\\S]*?)<\\/state><note><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/note><actor><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/actor><director><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/director><dl>([\\s\\S]*?)<\\/dl><des><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/des><reurl>([\\s\\S]*?)<\\/reurl><\\/video>/'; $xn_url = '/<dd flag="([\\s\\S]*?)"><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/dd>/'; $xn_vod_time = 1; $xn_vod_id = 2; $xn_vod_name = 4; $xn_vod_type = 3; $xn_vod_pic = 7; $xn_vod_language = 8; $xn_vod_area = 9; $xn_vod_year = 10; $xn_vod_state = 11; $xn_vod_remarks = 12; $xn_vod_starring = 13; $xn_vod_directed = 14; $xn_vod_urls = 15; $xn_vod_des = 16; } else { $xn_vod = '/<vod><id>([0-9]+)<\\/id><name><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/name><note><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/note><state>([\\s\\S]*?)<\\/state><type>([\\s\\S]*?)<\\/type><starring><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/starring><directed><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/directed><pic>([\\s\\S]*?)<\\/pic><time>([\\s\\S]*?)<\\/time><year>([\\s\\S]*?)<\\/year><area><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/area><language><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/language><urls>([\\s\\S]*?)<\\/urls><des><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/des><\\/vod>/'; $xn_url = '/<url from="([\\s\\S]*?)"><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/url>/'; $xn_vod_id = 1; $xn_vod_name = 2; $xn_vod_remarks = 3; $xn_vod_state = 4; $xn_vod_type = 5; $xn_vod_starring = 6; $xn_vod_directed = 7; $xn_vod_pic = 8; $xn_vod_time = 9; $xn_vod_year = 10; $xn_vod_area = 11; $xn_vod_language = 12; $xn_vod_des = 14; $xn_vod_urls = 13; } } $html = getPage($url, "utf-8"); if (html == false) { echo "<table class=\"tb\"><tr><td colspan=2> <a href=\"javascript:void(0)\" onclick=\"location.reload();\">获取数据失败,请点击我重试</a></td></tr></table>"; exit; } if ($xt == "1" || $xt == "2") { $pagecount = intval(getBody($html, "pagecount=\"", "\" pagesize")); } else { $pagecount = intval(getBody($html, "<pagecount>", "</pagecount>")); } if ($pagecount == 0) { echo "<table class=\"tb\"><tr><td><br>没有任何可用数据<script language=\"javascript\">setTimeout(\"gonextpage();\",5000);function gonextpage(){location.href='?action=list&xt=" . $xt . "&rid=" . $rid . "&cjflag=" . $cjflag . "&cjurl=" . $cjurl . "';}</script></td></tr></table>"; exit; } echo "<table class=\"tb\"><tr><td colspan=2>视频采集地址 " . $url . "</td></tr><tr><td colspan=2> 共" . $pagecount . "页,正在采集第" . $rpage . "页</td></tr>"; preg_match_all($xn_vod, $html, $array3); $i = 0; foreach ($array3[1] as $key => $value) { $rc = false; $vodid = $array3[$xn_vod_id][$key]; $vodname = $array3[$xn_vod_name][$key]; $vodremarks = $array3[$xn_vod_remarks][$key]; $vodstate = $array3[$xn_vod_state][$key]; $vodtype = $cjflag . $array3[$xn_vod_type][$key]; $vodstarring = $array3[$xn_vod_starring][$key]; $voddirected = $array3[$xn_vod_directed][$key]; $vodpic = $array3[$xn_vod_pic][$key]; $vodtime = $array3[$xn_vod_time][$key]; $vodyear = $array3[$xn_vod_year][$key]; $vodarea = $array3[$xn_vod_area][$key]; $vodlanguage = $array3[$xn_vod_language][$key]; $voddes = $array3[$xn_vod_des][$key]; $vodurls = $array3[$xn_vod_urls][$key]; preg_match_all($xn_url, $vodurls, $array4); $vodsubname = ""; $vodcolor = ""; $vodhitstime = ""; $voddownurl = ""; $vodplayserver = "0"; $vodfrom = ""; $vodurl = ""; $vodname = replaceStr($vodname, "'", ""); if (strlen($vodname) > 255) { $vodname = substring($vodname, 255); } $vodenname = Hanzi2PinYin($vodname); if (strlen($vodenname) > 255) { $vodenname = substring($vodenname, 255); } if (!isN($vodenname)) { $vodletter = strtoupper(substring($vodenname, 1)); } $vodstate = replaceStr($vodstate, "[", ""); $vodstate = replaceStr($vodstate, "]", ""); if (!isNum($vodstate)) { $vodstate = 0; } $vodstarring = replaceStr($vodstarring, "'", ""); $vodstarring = replaceStr($vodstarring, "、", " "); $vodstarring = replaceStr($vodstarring, ",", " "); $vodstarring = replaceStr($vodstarring, ",", " "); $vodstarring = replaceStr($vodstarring, " ", " "); if (strlen($vodstarring) > 255) { $vodstarring = substring($vodstarring, 255); } $vodyear = replaceStr($vodyear, "'", ""); if (strlen($vodyear) > 32) { $vodyear = substring($vodyear, 32); } $vodlanguage = replaceStr($vodlanguage, "'", ""); if (strlen($vodlanguage) > 32) { $vodlanguage = substring($vodlanguage, 32); } $vodarea = replaceStr($vodarea, "'", ""); if (strlen($vodarea) > 32) { $vodarea = substring($vodarea, 32); } $vodpic = replaceStr($vodpic, "'", ""); if (strlen($vodpic) > 255) { $vodpic = substring($vodpic, 255); } $voddes = htmlDecode($voddes); $voddes = replaceStr($voddes, "'", ""); $vodtype = getTypeID($vodtype); if (!isNum($vodtype)) { $vodtype = 0; } if ($vodtype > 0) { $sql = "SELECT * FROM {pre}vod WHERE d_name ='" . $vodname . "' "; $row = $db->getRow($sql); if (!$row) { foreach ($array4[1] as $key => $value) { if ($rc) { $vodfrom .= "\$\$\$"; $vodurl .= "\$\$\$"; } $vodfrom .= getFrom($value); if ($xt == "1") { $vodurl .= getVUrl($array4[2][$key]); } else { $vodurl .= $array4[2][$key]; } if (substring($vodurl, 1, strlen($vodurl) - 1) == Chr(13)) { $vodurl = substring($vodurl, strlen($vodurl) - 1); } $vodurl = replaceStr($vodurl, Chr(10), "#"); $vodurl = replaceStr($vodurl, Chr(13), "#"); $vodurl = replaceStr($vodurl, "##", "#"); $vodurl = replaceStr($vodurl, "'", "''"); $rc = true; } $db->Add("{pre}vod", array("d_type", "d_name", "d_subname", "d_enname", "d_letter", "d_state", "d_color", "d_content", "d_remarks", "d_pic", "d_level", "d_hits", "d_starring", "d_directed", "d_year", "d_area", "d_language", "d_addtime", "d_time", "d_playurl", "d_downurl", "d_playfrom", "d_playserver"), array($vodtype, $vodname, $vodsubname, $vodenname, $vodletter, $vodstate, $vodcolor, $voddes, $vodremarks, $vodpic, 0, 0, $vodstarring, $voddirected, $vodyear, $vodarea, $vodlanguage, date('Y-m-d H:i:s', time()), date('Y-m-d H:i:s', time()), $vodurl, $voddownurl, $vodfrom, $vodplayserver)); wTips($vodname, "新增数据"); } else { $tmpplayurl = $row["d_playurl"]; $tmpplayfrom = $row["d_playfrom"]; $tmpplayserver = $row["d_playserver"]; foreach ($array4[1] as $key => $value) { $vodfrom = getFrom($value); if ($xt == "1") { $vodurl = getVUrl($array4[2][$key]); } else { $vodurl = $array4[2][$key]; } if (substring($vodurl, 1, strlen($vodurl) - 1) == Chr(13)) { $vodurl = substring($vodurl, strlen($vodurl) - 1); } $vodurl = replaceStr($vodurl, Chr(10), "#"); $vodurl = replaceStr($vodurl, Chr(13), "#"); $vodurl = replaceStr($vodurl, "##", "#"); $vodurl = replaceStr($vodurl, "'", "''"); if ($tmpplayurl == $vodurl) { $resultdes = "无需更新播放地址"; continue; } else { if (isN($vodfrom)) { wTips($vodname, "播放器类型为空,跳过"); continue; } else { if (isN($tmpplayurl) || strpos("," . $row["d_playfrom"], $vodfrom) <= 0) { $resultdes = "新增播放地址组"; $tmpplayurl .= "\$\$\$" . $vodurl; $tmpplayfrom .= "\$\$\$" . $vodfrom; $tmpplayserver .= "\$\$\$" . $vodplayserver; } else { $resultdes = "更新播放地址"; $arr1 = explode("\$\$\$", $tmpplayurl); $arr2 = explode("\$\$\$", $tmpplayfrom); $rc = false; $tmpplayurl = ""; for ($k = 0; $k < count($arr2); $k++) { if ($rc) { $tmpplayurl .= "\$\$\$"; } if ($arr2[$k] == $vodfrom) { $arr1[$k] = $vodurl; } $tmpplayurl .= $arr1[$k]; $rc = true; } } } } } $tmpplayurl = replaceStr($tmpplayurl, Chr(13), "#"); if (strpos("," . $row["d_pic"], "http:") <= 0) { $vodpic = $row["d_pic"]; } $db->Update("{pre}vod", array("d_state", "d_pic", "d_remarks", "d_time", "d_playurl", "d_playfrom", "d_playserver"), array($vodstate, $vodpic, $vodremarks, date('Y-m-d H:i:s', time()), $tmpplayurl, $tmpplayfrom, $tmpplayserver), "d_id=" . $row["d_id"]); wTips($vodname, $resultdes); } unset($row); } else { wTips($vodname, "没有绑定分类、跳过"); } unset($array4); } unset($array3); echo "</table>"; if ($action == "cjday" || $action == "cjall" || $action == "cjtype") { if ($rpage >= $pagecount) { dBreakpoint("../upload/maccjbreakpoint"); echo "<br>数据采集完成<script language=\"javascript\">setTimeout(\"gonextpage();\",3000);function gonextpage(){location.href='?action=list&fa=1&xt=" . $xt . "&rid=" . $rid . "&cjflag=" . $cjflag . "&rtype=" . $rtype . "&cjurl=" . $cjurl . "';}</script>"; } else { echo "<br>暂停3秒后继续采集...<script language=\"javascript\">setTimeout(\"gonextpage();\",3000);function gonextpage(){location.href='?action=" . $action . "&rpage=" . ($rpage + 1) . "&rtype=" . $rtype . "&rday=" . $rday . "&xt=" . $xt . "&rid=" . $rid . "&cjflag=" . $cjflag . "&cjurl=" . $cjurl . "';}</script><a href=\"?action=" . $action . "&rpage=" . ($rpage + 1) . "&rtype=" . $rtype . "&xt=" . $xt . "&rid=" . $rid . "&cjflag=" . $cjflag . "&cjurl=" . $cjurl . "\" >点击进入下一页</a>"; } } else { dBreakpoint("../upload/maccjbreakpoint"); echo "<br>数据采集完成<script language=\"javascript\">setTimeout(\"gonextpage();\",3000);function gonextpage(){location.href='?action=list&fa=1&xt=" . $xt . "&rid=" . $rid . "&cjflag=" . $cjflag . "&rpage=" . $rpage . "&rtype=" . $rtype . "&cjurl=" . $cjurl . "';}</script>"; } }