Merge pull request #81 from wonipapa/devel

Update 1.2.4p1
This commit is contained in:
wonipapa 2018-02-08 10:11:11 +09:00 committed by GitHub
commit c883a57f19
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 30 additions and 26 deletions

View File

@ -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.4"); define("VERSION", "1.2.4p1");
$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;
@ -969,7 +969,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 - 1)." days")); $day = date("Y-m-d", strtotime("+".($k - 2)." days"));
$params = array( $params = array(
's_idx' => $ServiceId, 's_idx' => $ServiceId,
'c_date' => $day 'c_date' => $day

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python2
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import print_function from __future__ import print_function
@ -44,7 +44,7 @@ if not sys.version_info[:2] == (2, 7):
sys.exit() sys.exit()
# Set variable # Set variable
__version__ = '1.2.4' __version__ = '1.2.4p1'
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': '*/*'}
@ -392,6 +392,7 @@ def GetEPGFromSKB(ChannelInfo):
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':'dawn'})
soup = BeautifulSoup(data, htmlparser, parse_only=strainer, from_encoding='utf-8') soup = BeautifulSoup(data, htmlparser, parse_only=strainer, from_encoding='utf-8')
soup = soup.prettify()
html = soup.find_all('li') if soup.find_all('li') else '' html = soup.find_all('li') if soup.find_all('li') else ''
if(html): if(html):
for row in html: for row in html:
@ -401,14 +402,17 @@ def GetEPGFromSKB(ChannelInfo):
startTime = str(day) + ' ' + row.find('span', {'class':'time'}).text startTime = str(day) + ' ' + row.find('span', {'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'}).text.decode('string_escape').strip() cell = row.find('span', {'class':'title'})
pattern = "^(.*?)(\(([\d,]+)회\))?(<(.*)>)?(\((재)\))?$" print(cell)
matches = re.match(pattern, cell) if(cell):
if not(matches is None) : cell = cell.text.decode('string_escape').strip()
programName = matches.group(1) if matches.group(1) else '' pattern = "^(.*?)(\(([\d,]+)회\))?(<(.*)>)?(\((재)\))?$"
subprogramName = matches.group(5) if matches.group(5) else '' matches = re.match(pattern, cell)
rebroadcast = True if matches.group(7) else False if not(matches is None) :
episode = matches.group(3) if matches.group(3) else '' programName = matches.group(1) if matches.group(1) else ''
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('span', {'class':re.compile('^watch.*$')})
if not(rating is None) : if not(rating is None) :
rating = int(rating.text.decode('string_escape').replace('','').strip()) rating = int(rating.text.decode('string_escape').replace('','').strip())