static function crawlerProgramItems($date, $chnnel) { $url = replaceStr(CnTVLiveParse::BASE_EPISODE, '{DATE}', $date); $url = replaceStr($url, '{TV_CODE}', $chnnel); $client = new HttpClient('tv.cntv.cn'); $client->get('/epg'); $client->get($url); writetofile("program_live_item_crawler.log", "url:[http://tv.cntv.cn" . $url . "]"); $content = $client->getContent(); return CnTVLiveParse::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 . "]"); } }