diff --git a/epg2xml.php b/epg2xml.php
index c1662e5..eda5157 100644
--- a/epg2xml.php
+++ b/epg2xml.php
@@ -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>/';
- $html = preg_replace_callback($pattern, function($matches) { return ' | '.htmlspecialchars($matches[1]).' | ';}, $html);
+ $response = preg_replace_callback($pattern, function($matches) { return ''.htmlspecialchars($matches[1]).' | ';}, $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;
diff --git a/epg2xml.py b/epg2xml.py
index 0c4e6af..2d74c40 100644
--- a/epg2xml.py
+++ b/epg2xml.py
@@ -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