HCN 함수까지 체크

This commit is contained in:
wonipapa 2017-09-01 15:49:50 +09:00
parent 4b62f0140d
commit 3a23591216
2 changed files with 11 additions and 7 deletions

View File

@ -953,13 +953,13 @@ function GetEPGFromIscs($ChannelInfo) {
printError($ChannelName.CHANNEL_ERROR);
endif;
else :
$html = $data['html'];
$response = $data['html'];
$response = mb_convert_encoding($response, "HTML-ENTITIES", "UTF-8");
$pattern = '/<td class="name">(.*)<\/td>/';
$html = preg_replace_callback($pattern, function($matches) { return '<td class="name">'.htmlspecialchars($matches[1]).'</td>';}, $html);
$response = preg_replace_callback($pattern, function($matches) { return '<td class="name">'.htmlspecialchars($matches[1]).'</td>';}, $response);
$dom = new DomDocument;
libxml_use_internal_errors(True);
$html = mb_convert_encoding($html, "HTML-ENTITIES", "UTF-8");
if($dom->loadHTML($html)):
if($dom->loadHTML($response)):
$xpath = new DomXPath($dom);
$query = "//div[@class='pp_tbl']/table/tbody/tr";
$rows = $xpath->query($query);
@ -1019,9 +1019,9 @@ function GetEPGFromHcn($ChannelInfo) {
if ($response === False && $GLOBALS['debug']) :
printError($ChannelName.HTTP_ERROR);
else :
$response = mb_convert_encoding($response, "HTML-ENTITIES", "EUC-KR");
$dom = new DomDocument;
libxml_use_internal_errors(True);
$response = mb_convert_encoding($response, "HTML-ENTITIES", "EUC-KR");
if($dom->loadHTML($response)):
$xpath = new DomXPath($dom);
$query = "//tr[@class='']";
@ -1034,10 +1034,12 @@ function GetEPGFromHcn($ChannelInfo) {
$startTime = $cells->item(0)->nodeValue ?: "";
$startTime = date("YmdHis", strtotime($day." ".$startTime));
$programName = trim($cells->item(1)->nodeValue) ?: "";
$category = trim($cells->item(2)->nodeValue) ?: "";
$category = preg_replace('/\(.*\)/', '', $category);
$images = $row->getElementsByTagName('img');
foreach($images as $image):
preg_match('/re\.png/', $image->getAttribute('src'), $rebroadcast);
if($rebroadcast != NULL) $rebroadcast = True;
preg_match('/re\.png/', $image->getAttribute('src'), $rebroad);
if($rebroad != NULL) $rebroadcast = True;
preg_match('/.*plus([\d,]+)\.png/', $image->getAttribute('src'), $grade);
if($grade != NULL) $rating = $grade[1];
endforeach;

View File

@ -579,6 +579,8 @@ def GetEPGFromHcn(ChannelInfo):
startTime = datetime.datetime.strptime(startTime, '%Y-%m-%d %H:%M')
startTime = startTime.strftime('%Y%m%d%H%M%S')
programName = row.find('td', {'class':'left'}).text.decode('string_escape').strip()
category = row.find('td', {'class':'l'}).text.decode('string_escape').strip()
category = re.sub('\(.*\)', '', category)
for image in row.find_all('img', {'class':'vM'}, alt=True):
rebroad = re.match('(재방송)',image['alt'].decode('string_escape').strip())
if not (rebroad is None): rebroadcast = True