static function crawlerProgramItems($date, $chnnel) { $dateTime = strtotime($date); $date = date('w', $dateTime); if ($date === '0') { $date = '7'; } $url = replaceStr(TVSouLiveParse::BASE_EPISODE, '{DATE}', $date); $url = replaceStr($url, '{TV_CODE}', $chnnel); $content = getPage($url, "gb2312"); writetofile("program_live_item_crawler.log", "url:[" . $url . "]"); // var_dump($url); return TVSouLiveParse::parseMovieInfoByContent($content, $p_code, $type); }
function parseVodPadSimple($id, $tv_code, $day, $tv_playfrom) { global $db; if ($tv_playfrom === 'cntv') { $result = CnTVLiveParse::crawlerProgramItems($day, $tv_code); } else { $result = TVSouLiveParse::crawlerProgramItems($day, $tv_code); } if ($result !== false && is_array($result) && count($result) > 0) { writetofile("program_live_item_crawler_result.log", "program items exist: channel:[" . $tv_code . "];day:[" . $day . "]"); $db->Delete("mac_tv_program_item", 'tv_id=' . $id . ' and day=\'' . $day . '\''); foreach (array_keys($result) as $play_time) { $video_name = $result[$play_time]; $program_type = $db->getOne("select program_type from mac_tv_program_type_item where program_name='" . $video_name . "'"); if (!$program_type) { $program_type = ''; } $db->Add("mac_tv_program_item", array("tv_id", "day", "play_time", "video_name", "program_type"), array($id, $day, $play_time, $video_name, $program_type)); } } else { writetofile("program_live_item_crawler_no_result.log", "program items exist: channel:[" . $tv_code . "];day:[" . $day . "]"); } }