commit
55f48ac21f
@ -232,7 +232,7 @@
|
||||
{ "Id": 294, "Name": "쿠키건강TV", "KT Name": "쿠키건강TV", "KTCh": 220, "LG Name": "쿠키건강TV", "LGCh": 144, "SK Name": "쿠키건강TV", "SKCh": 269, "Radio Name": "", "RadioCh": null, "Icon_url": "http://i.imgur.com/4gl92D1.png", "Source": "EPG", "ServiceId": "735" },
|
||||
{ "Id": 296, "Name": "키즈원", "KT Name": "키즈원", "KTCh": 148, "LG Name": "키즈원", "LGCh": 157, "SK Name": "KIDS1", "SKCh": 193, "Radio Name": "", "RadioCh": null, "Icon_url": "http://i.imgur.com/f8T1Sw4.png", "Source": "NAVER", "ServiceId": "815020" },
|
||||
{ "Id": 297, "Name": "토마토TV", "KT Name": "토마토TV", "KTCh": 185, "LG Name": "토마토TV", "LGCh": 111, "SK Name": "토마토TV", "SKCh": 150, "Radio Name": "", "RadioCh": null, "Icon_url": "http://i.imgur.com/dVWy3Ex.png", "Source": "SK", "ServiceId": "620" },
|
||||
{ "Id": 299, "Name": "핑크하우스", "KT Name": "핑크하우스", "KTCh": 208, "LG Name": "", "LGCh": null, "SK Name": "핑크하우스", "SKCh": 324, "Radio Name": "", "RadioCh": null, "Icon_url": "http://i.imgur.com/03U2Ges.png", "Source": "EPG", "ServiceId": "599" },
|
||||
{ "Id": 299, "Name": "핑크하우스", "KT Name": "핑크하우스", "KTCh": 208, "LG Name": "", "LGCh": null, "SK Name": "핑크하우스", "SKCh": 324, "Radio Name": "", "RadioCh": null, "Icon_url": "https://i.imgur.com/RnEFpd6.png", "Source": "EPG", "ServiceId": "599" },
|
||||
{ "Id": 301, "Name": "가톨릭평화방송", "KT Name": "가톨릭평화방송", "KTCh": 231, "LG Name": "가톨릭평화방송", "LGCh": 184, "SK Name": "가톨릭평화방송", "SKCh": 307, "Radio Name": "", "RadioCh": null, "Icon_url": "http://i.imgur.com/G5fTCL3.png", "Source": "HCN", "ServiceId": "33" },
|
||||
{ "Id": 302, "Name": "폴라리스TV", "KT Name": "폴라리스TV", "KTCh": 129, "LG Name": "폴라리스 TV", "LGCh": 67, "SK Name": "폴라리스TV", "SKCh": 249, "Radio Name": "", "RadioCh": null, "Icon_url": "http://i.imgur.com/aghufJ7.png", "Source": "SK", "ServiceId": "252" },
|
||||
{ "Id": 303, "Name": "한국경제TV", "KT Name": "한국경제TV", "KTCh": 180, "LG Name": "한국경제TV", "LGCh": 121, "SK Name": "한국경제TV", "SKCh": 151, "Radio Name": "", "RadioCh": null, "Icon_url": "http://i.imgur.com/ChnD0FT.png", "Source": "NAVER", "ServiceId": "814929" },
|
||||
@ -244,8 +244,8 @@
|
||||
{ "Id": 313, "Name": "현대홈쇼핑+샵", "KT Name": "현대홈쇼핑+샵", "KTCh": 36, "LG Name": "현대홈쇼핑+샵", "LGCh": 34, "SK Name": "현대홈쇼핑+Shop", "SKCh": 39, "Radio Name": "", "RadioCh": null, "Icon_url": "http://i.imgur.com/COo8Bcm.png", "Source": "SK", "ServiceId": "337" },
|
||||
{ "Id": 314, "Name": "홈&쇼핑", "KT Name": "홈&쇼핑", "KTCh": 14, "LG Name": "홈앤쇼핑", "LGCh": 4, "SK Name": "홈&쇼핑", "SKCh": 4, "Radio Name": "", "RadioCh": null, "Icon_url": "http://i.imgur.com/nLxw0LW.png", "Source": "NAVER", "ServiceId": "815524" },
|
||||
{ "Id": 315, "Name": "환경TV", "KT Name": "환경TV", "KTCh": 166, "LG Name": "", "LGCh": null, "SK Name": "환경TV", "SKCh": 276, "Radio Name": "", "RadioCh": null, "Icon_url": "http://i.imgur.com/eITOr2Y.png", "Source": "HCN", "ServiceId": "29" },
|
||||
{ "Id": 316, "Name": "Life N", "KT Name": "", "KTCh": null, "LG Name": "", "LGCh": null, "SK Name": "Life N", "SKCh": 215, "Radio Name": "", "RadioCh": null, "Icon_url": "http://i.imgur.com/qNde2j7.png", "Source": "SKB", "ServiceId": "277" },
|
||||
{ "Id": 317, "Name": "Discovery HD", "KT Name": "", "KTCh": null, "LG Name": "디스커버리 아시아", "LGCh": 133, "SK Name": "", "SKCh": null, "Radio Name": "", "RadioCh": null, "Icon_url": "http://i.imgur.com/bH9BY7E.png", "Source": "SKY", "ServiceId": "929" },
|
||||
{ "Id": 316, "Name": "Life U", "KT Name": "", "KTCh": null, "LG Name": "", "LGCh": null, "SK Name": "Life U", "SKCh": 215, "Radio Name": "", "RadioCh": null, "Icon_url": "https://i.imgur.com/3VJOGoI.png", "Source": "SKB", "ServiceId": "277" },
|
||||
{ "Id": 317, "Name": "디스커버리 아시아", "KT Name": "", "KTCh": null, "LG Name": "디스커버리 아시아", "LGCh": 133, "SK Name": "", "SKCh": null, "Radio Name": "", "RadioCh": null, "Icon_url": "https://i.imgur.com/6NdyDW5.png", "Source": "LG", "ServiceId": "610" },
|
||||
{ "Id": 318, "Name": "Celestial Movies", "KT Name": "", "KTCh": null, "LG Name": "", "LGCh": null, "SK Name": "Celestial Movies", "SKCh": 62, "Radio Name": "", "RadioCh": null, "Icon_url": "http://i.imgur.com/xDXM13Q.png", "Source": "SKB", "ServiceId": "877" },
|
||||
{ "Id": 319, "Name": "UHD Dream TV", "KT Name": "", "KTCh": null, "LG Name": "", "LGCh": null, "SK Name": "UHD Dream TV", "SKCh": 71, "Radio Name": "", "RadioCh": null, "Icon_url": "http://i.imgur.com/aLG2rKa.png", "Source": "SKY", "ServiceId": "689" },
|
||||
{ "Id": 320, "Name": "UMAX", "KT Name": "", "KTCh": null, "LG Name": "", "LGCh": null, "SK Name": "UMAX", "SKCh": 73, "Radio Name": "", "RadioCh": null, "Icon_url": "http://i.imgur.com/EgVuybQ.png", "Source": "SKB", "ServiceId": "69" },
|
||||
|
@ -120,6 +120,7 @@ https://github.com/wonipapa/epg2xml/wiki/FAQ
|
||||
## 변경사항
|
||||
### Version 1.2.5
|
||||
- SKB 함수 수정
|
||||
- SKB 함수 수정(p1)
|
||||
### Version 1.2.4
|
||||
- ISCS 함수 수정
|
||||
- SKB 함수 수정(p1)
|
||||
|
@ -3,7 +3,7 @@
|
||||
@date_default_timezone_set('Asia/Seoul');
|
||||
error_reporting(E_ALL ^ E_NOTICE);
|
||||
@set_time_limit(0);
|
||||
define("VERSION", "1.2.5");
|
||||
define("VERSION", "1.2.5p1");
|
||||
$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'";
|
||||
$timeout = 5;
|
||||
@ -751,18 +751,22 @@ function GetEPGFromSKB($ChannelInfo) {
|
||||
if ($response === False && $GLOBALS['debug']) :
|
||||
printError($ChannelName.HTTP_ERROR);
|
||||
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('/<span><\/span>/is', '', $response);
|
||||
//$response = preg_replace('/<strong class="hide">프로그램 안내<\/strong>/is', '', $response);
|
||||
//$response = preg_replace('/<span.*\\/span>/is', '', $response);
|
||||
$pattern = '/<span>(.*)<\/span>/';
|
||||
$response = preg_replace_callback($pattern, function($matches) { return '<span class="title">'.htmlspecialchars($matches[1], ENT_NOQUOTES).'</span>';}, $response);
|
||||
$response = preg_replace('/<span class="round_flag flag02">(.*?)<\/span>/', '', $response);
|
||||
$response = preg_replace('/<span class="round_flag flag03">(.*?)<\/span>/', '', $response);
|
||||
$response = preg_replace('/<span class="round_flag flag04">(.*?)<\/span>/', '', $response);
|
||||
$response = preg_replace('/<span class="round_flag flag09">(.*?)<\/span>/', '', $response);
|
||||
$response = preg_replace('/<span class="round_flag flag10">(.*?)<\/span>/', '', $response);
|
||||
$response = preg_replace('/<span class="round_flag flag11">(.*?)<\/span>/', '', $response);
|
||||
$response = preg_replace('/<span class="round_flag flag12">(.*?)<\/span>/', '', $response);
|
||||
$response = preg_replace('/<strong class="hide">프로그램 안내<\/strong>/', '', $response);
|
||||
$dom = new DomDocument;
|
||||
libxml_use_internal_errors(True);
|
||||
if($dom->loadHTML('<?xml encoding="utf-8" ?>'.$response)):
|
||||
$xpath = new DomXPath($dom);
|
||||
$query = "//span[@class='caption' or @class='explan' or @class='fullHD' or @class='UHD' or @class='nowon' or @class='flag_box']";
|
||||
$query = "//span[@class='caption' or @class='explan' or @class='fullHD' or @class='UHD' or @class='nowon']";
|
||||
$spans = $xpath->query($query);
|
||||
foreach($spans as $span) :
|
||||
$span->parentNode->removeChild( $span);
|
||||
@ -776,7 +780,7 @@ function GetEPGFromSKB($ChannelInfo) {
|
||||
$cells = $row->getElementsByTagName('p');
|
||||
$startTime = $cells->item(0)->nodeValue ?: "";
|
||||
$startTime = date("YmdHis", strtotime($day." ".$startTime));
|
||||
$programName = trim($cells->item(1)->nodeValue) ?: "";
|
||||
$programName = trim($cells->item(1)->childNodes->item(0)->nodeValue) ?: "";
|
||||
$pattern = '/^(.*?)(\(([\d,]+)회\))?(<(.*)>)?(\((재)\))?$/';
|
||||
preg_match($pattern, $programName, $matches);
|
||||
if ($matches != NULL) :
|
||||
@ -784,8 +788,8 @@ function GetEPGFromSKB($ChannelInfo) {
|
||||
if(isset($matches[5])) $subprogramName = trim($matches[5]) ?: "";
|
||||
if(isset($matches[3])) $episode = $matches[3] ?: "";
|
||||
if(isset($matches[7])) $rebroadcast = $matches[7] ? True : False;
|
||||
endif;
|
||||
if($cells->length > 3) $rating = str_replace('세', '', $cells->item(3)->nodeValue) ?: 0;
|
||||
endif;
|
||||
if(trim($cells->item(1)->childNodes->item(1)->nodeValue)) $rating = str_replace('세 이상', '', trim($cells->item(1)->childNodes->item(1)->nodeValue)) ?: 0;
|
||||
//ChannelId, startTime, programName, subprogramName, desc, actors, producers, category, episode, rebroadcast, rating
|
||||
$epginfo[] = array($ChannelId, $startTime, $programName, $subprogramName, $desc, $actors, $producers, $category, $episode, $rebroadcast, $rating);
|
||||
usleep(1000);
|
||||
|
28
epg2xml.py
28
epg2xml.py
@ -44,7 +44,7 @@ if not sys.version_info[:2] == (2, 7):
|
||||
sys.exit()
|
||||
|
||||
# Set variable
|
||||
__version__ = '1.2.5'
|
||||
__version__ = '1.2.5p1'
|
||||
debug = False
|
||||
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': '*/*'}
|
||||
@ -381,17 +381,14 @@ def GetEPGFromSKB(ChannelInfo):
|
||||
html_data = response.content
|
||||
data = unicode(html_data, 'euc-kr', 'ignore').encode('utf-8', 'ignore')
|
||||
data = re.sub('<!--(.*?)-->', '', data, 0, re.I|re.S)
|
||||
data = re.sub('<span></span>', '', data)
|
||||
data = re.sub('<span class="title">', '<span>', data)
|
||||
data = re.sub('<span class="explan">화면해설</span>','',data)
|
||||
data = re.sub('<span class="caption">자막방송</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="nowon">now on</span>','',data)
|
||||
data = re.sub('<span class="flag_box">','',data)
|
||||
data = re.sub('<strong class="hide">프로그램 안내</strong>', '',data)
|
||||
pattern = '<span>(.*)<\/span>'
|
||||
data = re.sub(pattern, partial(replacement, tag='span'), data)
|
||||
data = re.sub('<span class="round_flag flag02">(.*?)</span>', '', data)
|
||||
data = re.sub('<span class="round_flag flag03">(.*?)</span>', '', data)
|
||||
data = re.sub('<span class="round_flag flag04">(.*?)</span>', '', data)
|
||||
data = re.sub('<span class="round_flag flag09">(.*?)</span>', '', data)
|
||||
data = re.sub('<span class="round_flag flag10">(.*?)</span>', '', data)
|
||||
data = re.sub('<span class="round_flag flag11">(.*?)</span>', '', data)
|
||||
data = re.sub('<span class="round_flag flag12">(.*?)</span>', '', data)
|
||||
data = re.sub('<strong class="hide">프로그램 안내</strong>', '', data)
|
||||
strainer = SoupStrainer('div', {'id':'uiScheduleTabContent'})
|
||||
soup = BeautifulSoup(data, htmlparser, parse_only=strainer, from_encoding='utf-8')
|
||||
html = soup.find_all('li',{'class':'list'}) if soup.find_all('li') else ''
|
||||
@ -405,6 +402,8 @@ def GetEPGFromSKB(ChannelInfo):
|
||||
startTime = startTime.strftime('%Y%m%d%H%M%S')
|
||||
cell = row.find('p', {'class':'cont'})
|
||||
if(cell):
|
||||
if cell.find('span'):
|
||||
cell.span.decompose()
|
||||
cell = cell.text.decode('string_escape').strip()
|
||||
pattern = "^(.*?)(\(([\d,]+)회\))?(<(.*)>)?(\((재)\))?$"
|
||||
matches = re.match(pattern, cell)
|
||||
@ -413,9 +412,10 @@ def GetEPGFromSKB(ChannelInfo):
|
||||
subprogramName = matches.group(5) if matches.group(5) else ''
|
||||
rebroadcast = True if matches.group(7) else False
|
||||
episode = matches.group(3) if matches.group(3) else ''
|
||||
rating = row.find('span', {'class':re.compile('^watch.*$')})
|
||||
rating = row.find('i', {'class':'hide'})
|
||||
if not(rating is None) :
|
||||
rating = int(rating.text.decode('string_escape').replace('세','').strip())
|
||||
rating = int(rating.text.decode('string_escape').replace('세 이상','').strip())
|
||||
|
||||
#ChannelId, startTime, programName, subprogramName, desc, actors, producers, category, episode, rebroadcast, rating
|
||||
epginfo.append([ChannelId, startTime, programName, subprogramName, desc, actors, producers, category, episode, rebroadcast, rating])
|
||||
time.sleep(0.001)
|
||||
|
Loading…
x
Reference in New Issue
Block a user