commit
84bc5a16d2
@ -118,8 +118,11 @@ https://github.com/wonipapa/epg2xml/wiki
|
|||||||
https://github.com/wonipapa/epg2xml/wiki/FAQ
|
https://github.com/wonipapa/epg2xml/wiki/FAQ
|
||||||
|
|
||||||
## 변경사항
|
## 변경사항
|
||||||
|
### Version 1.2.5
|
||||||
|
- SKB 함수 수정
|
||||||
### Version 1.2.4
|
### Version 1.2.4
|
||||||
- ISCS 함수 수정
|
- ISCS 함수 수정
|
||||||
|
- SKB 함수 수정(p1)
|
||||||
### Version 1.2.3
|
### Version 1.2.3
|
||||||
- PHP 버전통합
|
- PHP 버전통합
|
||||||
- PYTHON 버전 html Parser 변수 추가(libxml지원안하는 기기 편의 지원)
|
- PYTHON 버전 html Parser 변수 추가(libxml지원안하는 기기 편의 지원)
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
@date_default_timezone_set('Asia/Seoul');
|
@date_default_timezone_set('Asia/Seoul');
|
||||||
error_reporting(E_ALL ^ E_NOTICE);
|
error_reporting(E_ALL ^ E_NOTICE);
|
||||||
@set_time_limit(0);
|
@set_time_limit(0);
|
||||||
define("VERSION", "1.2.4p1");
|
define("VERSION", "1.2.5");
|
||||||
$debug = False;
|
$debug = False;
|
||||||
$ua = "'Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.116 Safari/537.36'";
|
$ua = "'Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.116 Safari/537.36'";
|
||||||
$timeout = 5;
|
$timeout = 5;
|
||||||
@ -752,30 +752,31 @@ function GetEPGFromSKB($ChannelInfo) {
|
|||||||
printError($ChannelName.HTTP_ERROR);
|
printError($ChannelName.HTTP_ERROR);
|
||||||
else :
|
else :
|
||||||
$response = str_replace('charset="euc-kr"', 'charset="utf-8"', $response);
|
$response = str_replace('charset="euc-kr"', 'charset="utf-8"', $response);
|
||||||
$response = mb_convert_encoding($response, "UTF-8", "EUC-KR");
|
|
||||||
$response = preg_replace('/<!--(.*?)-->/is', '', $response);
|
$response = preg_replace('/<!--(.*?)-->/is', '', $response);
|
||||||
$response = preg_replace('/<span><\/span>/is', '', $response);
|
$response = preg_replace('/<span><\/span>/is', '', $response);
|
||||||
|
//$response = preg_replace('/<strong class="hide">프로그램 안내<\/strong>/is', '', $response);
|
||||||
|
//$response = preg_replace('/<span.*\\/span>/is', '', $response);
|
||||||
$pattern = '/<span>(.*)<\/span>/';
|
$pattern = '/<span>(.*)<\/span>/';
|
||||||
$response = preg_replace_callback($pattern, function($matches) { return '<span class="title">'.htmlspecialchars($matches[1], ENT_NOQUOTES).'</span>';}, $response);
|
$response = preg_replace_callback($pattern, function($matches) { return '<span class="title">'.htmlspecialchars($matches[1], ENT_NOQUOTES).'</span>';}, $response);
|
||||||
$dom = new DomDocument;
|
$dom = new DomDocument;
|
||||||
libxml_use_internal_errors(True);
|
libxml_use_internal_errors(True);
|
||||||
if($dom->loadHTML('<?xml encoding="utf-8" ?>'.$response)):
|
if($dom->loadHTML('<?xml encoding="utf-8" ?>'.$response)):
|
||||||
$xpath = new DomXPath($dom);
|
$xpath = new DomXPath($dom);
|
||||||
$query = "//span[@class='caption' or @class='explan' or @class='fullHD' or @class='UHD' or @class='nowon']";
|
$query = "//span[@class='caption' or @class='explan' or @class='fullHD' or @class='UHD' or @class='nowon' or @class='flag_box']";
|
||||||
$spans = $xpath->query($query);
|
$spans = $xpath->query($query);
|
||||||
foreach($spans as $span) :
|
foreach($spans as $span) :
|
||||||
$span->parentNode->removeChild( $span);
|
$span->parentNode->removeChild( $span);
|
||||||
endforeach;
|
endforeach;
|
||||||
$query = "//div[@id='dawn']/ul/li";
|
$query = "//div[@id='uiScheduleTabContent']/div/ol/li";
|
||||||
$rows = $xpath->query($query);
|
$rows = $xpath->query($query);
|
||||||
foreach($rows as $row) :
|
foreach($rows as $row) :
|
||||||
$startTime = $endTime = $programName = $subprogramName = $desc = $actors = $producers = $category = $episode = "";
|
$startTime = $endTime = $programName = $subprogramName = $desc = $actors = $producers = $category = $episode = "";
|
||||||
$rebroadcast = False;
|
$rebroadcast = False;
|
||||||
$rating = 0;
|
$rating = 0;
|
||||||
$cells = $row->getElementsByTagName('span');
|
$cells = $row->getElementsByTagName('p');
|
||||||
$startTime = $cells->item(0)->nodeValue ?: "";
|
$startTime = $cells->item(0)->nodeValue ?: "";
|
||||||
$startTime = date("YmdHis", strtotime($day." ".$startTime));
|
$startTime = date("YmdHis", strtotime($day." ".$startTime));
|
||||||
$programName = trim($cells->item(2)->nodeValue) ?: "";
|
$programName = trim($cells->item(1)->nodeValue) ?: "";
|
||||||
$pattern = '/^(.*?)(\(([\d,]+)회\))?(<(.*)>)?(\((재)\))?$/';
|
$pattern = '/^(.*?)(\(([\d,]+)회\))?(<(.*)>)?(\((재)\))?$/';
|
||||||
preg_match($pattern, $programName, $matches);
|
preg_match($pattern, $programName, $matches);
|
||||||
if ($matches != NULL) :
|
if ($matches != NULL) :
|
||||||
@ -969,7 +970,7 @@ function GetEPGFromIscs($ChannelInfo) {
|
|||||||
foreach(range(1, $GLOBALS['period']) as $k) :
|
foreach(range(1, $GLOBALS['period']) as $k) :
|
||||||
$istomorrow = False;
|
$istomorrow = False;
|
||||||
$url = "https://www.iscs.co.kr/service/sub/ajax_channel_view.asp";
|
$url = "https://www.iscs.co.kr/service/sub/ajax_channel_view.asp";
|
||||||
$day = date("Y-m-d", strtotime("+".($k - 2)." days"));
|
$day = date("Y-m-d", strtotime("+".($k - 1)." days"));
|
||||||
$params = array(
|
$params = array(
|
||||||
's_idx' => $ServiceId,
|
's_idx' => $ServiceId,
|
||||||
'c_date' => $day
|
'c_date' => $day
|
||||||
|
14
epg2xml.py
14
epg2xml.py
@ -44,7 +44,7 @@ if not sys.version_info[:2] == (2, 7):
|
|||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
# Set variable
|
# Set variable
|
||||||
__version__ = '1.2.4p2'
|
__version__ = '1.2.5'
|
||||||
debug = False
|
debug = False
|
||||||
today = datetime.date.today()
|
today = datetime.date.today()
|
||||||
ua = {'User-Agent': 'Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.116 Safari/537.36', 'accept': '*/*'}
|
ua = {'User-Agent': 'Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.116 Safari/537.36', 'accept': '*/*'}
|
||||||
@ -388,20 +388,22 @@ def GetEPGFromSKB(ChannelInfo):
|
|||||||
data = re.sub('<span class="fullHD">Full HD</span>','',data)
|
data = re.sub('<span class="fullHD">Full HD</span>','',data)
|
||||||
data = re.sub('<span class="UHD">UHD</span>','',data)
|
data = re.sub('<span class="UHD">UHD</span>','',data)
|
||||||
data = re.sub('<span class="nowon">now on</span>','',data)
|
data = re.sub('<span class="nowon">now on</span>','',data)
|
||||||
|
data = re.sub('<span class="flag_box">','',data)
|
||||||
|
data = re.sub('<strong class="hide">프로그램 안내</strong>', '',data)
|
||||||
pattern = '<span>(.*)<\/span>'
|
pattern = '<span>(.*)<\/span>'
|
||||||
data = re.sub(pattern, partial(replacement, tag='span'), data)
|
data = re.sub(pattern, partial(replacement, tag='span'), data)
|
||||||
strainer = SoupStrainer('div', {'id':'dawn'})
|
strainer = SoupStrainer('div', {'id':'uiScheduleTabContent'})
|
||||||
soup = BeautifulSoup(data, htmlparser, parse_only=strainer, from_encoding='utf-8')
|
soup = BeautifulSoup(data, htmlparser, parse_only=strainer, from_encoding='utf-8')
|
||||||
html = soup.find_all('li') if soup.find_all('li') else ''
|
html = soup.find_all('li',{'class':'list'}) if soup.find_all('li') else ''
|
||||||
if(html):
|
if(html):
|
||||||
for row in html:
|
for row in html:
|
||||||
startTime = endTime = programName = subprogramName = desc = actors = producers = category = episode = ''
|
startTime = endTime = programName = subprogramName = desc = actors = producers = category = episode = ''
|
||||||
rebroadcast = False
|
rebroadcast = False
|
||||||
rating = 0
|
rating = 0
|
||||||
startTime = str(day) + ' ' + row.find('span', {'class':'time'}).text
|
startTime = str(day) + ' ' + row.find('p', {'class':'time'}).text
|
||||||
startTime = datetime.datetime.strptime(startTime, '%Y-%m-%d %H:%M')
|
startTime = datetime.datetime.strptime(startTime, '%Y-%m-%d %H:%M')
|
||||||
startTime = startTime.strftime('%Y%m%d%H%M%S')
|
startTime = startTime.strftime('%Y%m%d%H%M%S')
|
||||||
cell = row.find('span', {'class':'title'})
|
cell = row.find('p', {'class':'cont'})
|
||||||
if(cell):
|
if(cell):
|
||||||
cell = cell.text.decode('string_escape').strip()
|
cell = cell.text.decode('string_escape').strip()
|
||||||
pattern = "^(.*?)(\(([\d,]+)회\))?(<(.*)>)?(\((재)\))?$"
|
pattern = "^(.*?)(\(([\d,]+)회\))?(<(.*)>)?(\((재)\))?$"
|
||||||
@ -461,7 +463,7 @@ def GetEPGFromSKY(ChannelInfo):
|
|||||||
desc = description if description else ''
|
desc = description if description else ''
|
||||||
if desc:
|
if desc:
|
||||||
if summary : desc = desc + '\n' + summary
|
if summary : desc = desc + '\n' + summary
|
||||||
else:
|
else:
|
||||||
desc = summary
|
desc = summary
|
||||||
category = program['program_category1']
|
category = program['program_category1']
|
||||||
episode = program['episode_id'] if program['episode_id'] else ''
|
episode = program['episode_id'] if program['episode_id'] else ''
|
||||||
|
Loading…
x
Reference in New Issue
Block a user