HCN 함수 삭제(p3)
This commit is contained in:
		
							parent
							
								
									3eeca34c70
								
							
						
					
					
						commit
						f118269651
					
				@ -122,7 +122,7 @@ https://github.com/wonipapa/epg2xml/wiki/FAQ
 | 
			
		||||
  - SKB 함수 수정
 | 
			
		||||
  - SKB 함수 수정(p1)
 | 
			
		||||
  - SKY 함수 수정(p2)
 | 
			
		||||
  - HCN 함수 수정(p3)
 | 
			
		||||
  - HCN 함수 삭제(p3)
 | 
			
		||||
### Version 1.2.4
 | 
			
		||||
  - ISCS 함수 수정
 | 
			
		||||
  - SKB 함수 수정(p1)
 | 
			
		||||
 | 
			
		||||
@ -412,8 +412,6 @@ function getEPG() {
 | 
			
		||||
            GetEPGFromNaver($ChannelInfo);
 | 
			
		||||
        elseif($ChannelSource == 'ISCS') :
 | 
			
		||||
            GetEPGFromIscs($ChannelInfo);
 | 
			
		||||
        elseif($ChannelSource == 'HCN') :
 | 
			
		||||
            GetEPGFromHcn($ChannelInfo);
 | 
			
		||||
        elseif($ChannelSource == 'POOQ') :
 | 
			
		||||
            GetEPGFromPooq($ChannelInfo);
 | 
			
		||||
        elseif($ChannelSource == 'EVERYON') :
 | 
			
		||||
@ -1039,63 +1037,6 @@ function GetEPGFromIscs($ChannelInfo) {
 | 
			
		||||
    if($epginfo) epgzip($epginfo);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Get EPG data from Hcn
 | 
			
		||||
function GetEPGFromHcn($ChannelInfo) {
 | 
			
		||||
    $ChannelId = $ChannelInfo[0];
 | 
			
		||||
    $ChannelName = $ChannelInfo[1];
 | 
			
		||||
    $ServiceId =  $ChannelInfo[3];
 | 
			
		||||
    $epginfo = array();
 | 
			
		||||
    foreach(range(1, $GLOBALS['period']) as $k) :
 | 
			
		||||
        $url = "http://m.hcn.co.kr/sch_ScheduleList.action";
 | 
			
		||||
        $day = date("Y-m-d", strtotime("+".($k - 1)." days"));
 | 
			
		||||
        $params = array(
 | 
			
		||||
            'ch_id' => $ServiceId,
 | 
			
		||||
            'onairdate' => $day,
 | 
			
		||||
            '_' => _microtime()
 | 
			
		||||
        );
 | 
			
		||||
        $params = http_build_query($params);
 | 
			
		||||
        $method = "GET";
 | 
			
		||||
       try {
 | 
			
		||||
            $response = getWeb($url, $params, $method);
 | 
			
		||||
            if ($response === False && $GLOBALS['debug']) :
 | 
			
		||||
                printError($ChannelName.HTTP_ERROR);
 | 
			
		||||
            else :
 | 
			
		||||
                $response = mb_convert_encoding($response, "HTML-ENTITIES", "UTF-8");
 | 
			
		||||
                $dom = new DomDocument;
 | 
			
		||||
                libxml_use_internal_errors(True);
 | 
			
		||||
                if($dom->loadHTML($response)):
 | 
			
		||||
                    $xpath = new DomXPath($dom);
 | 
			
		||||
                    $query = "//li[@class!='noData']";
 | 
			
		||||
                    $rows = $xpath->query($query);
 | 
			
		||||
                    foreach($rows as $row) :
 | 
			
		||||
                        $startTime = $endTime = $programName = $subprogramName = $desc = $actors = $producers = $category = $episode = "";
 | 
			
		||||
                        $rebroadcast = False;
 | 
			
		||||
                        $rating = 0;
 | 
			
		||||
                        $startTime = trim($xpath->query("span[@class='progTime']", $row)->item(0)->nodeValue) ?: "";
 | 
			
		||||
                        $startTime = date("YmdHis", strtotime($day." ".$startTime));
 | 
			
		||||
                        $programName = trim($xpath->query("span[@class='progTitle']", $row)->item(0)->nodeValue) ?: "";
 | 
			
		||||
                        $images = $row->getElementsByTagName('img');
 | 
			
		||||
                        foreach($images as $image):
 | 
			
		||||
                            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;
 | 
			
		||||
                        //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);
 | 
			
		||||
                    endforeach;
 | 
			
		||||
                else :
 | 
			
		||||
                    if($GLOBALS['debug']) printError($ChannelName.CONTENT_ERROR);
 | 
			
		||||
                endif;
 | 
			
		||||
            endif;
 | 
			
		||||
        } catch (Exception $e) {
 | 
			
		||||
            if($GLOBALS['debug']) printError($e->getMessage());
 | 
			
		||||
        }
 | 
			
		||||
    endforeach;
 | 
			
		||||
    if($epginfo) epgzip($epginfo);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Get EPG data from POOQ
 | 
			
		||||
function GetEPGFromPooq($ChannelInfo) {
 | 
			
		||||
    $ChannelId = $ChannelInfo[0];
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										48
									
								
								epg2xml.py
									
									
									
									
									
								
							
							
						
						
									
										48
									
								
								epg2xml.py
									
									
									
									
									
								
							@ -132,8 +132,6 @@ def getEpg():
 | 
			
		||||
            GetEPGFromNaver(ChannelInfo)
 | 
			
		||||
        elif ChannelSource == 'ISCS':
 | 
			
		||||
            GetEPGFromIscs(ChannelInfo)
 | 
			
		||||
        elif ChannelSource == 'HCN':
 | 
			
		||||
            GetEPGFromHcn(ChannelInfo)
 | 
			
		||||
        elif ChannelSource == 'POOQ':
 | 
			
		||||
            GetEPGFromPooq(ChannelInfo)
 | 
			
		||||
        elif ChannelSource == 'EVERYON':
 | 
			
		||||
@ -579,52 +577,6 @@ def GetEPGFromIscs(ChannelInfo):
 | 
			
		||||
        epginfo = epginfo2
 | 
			
		||||
        epgzip(epginfo)
 | 
			
		||||
 | 
			
		||||
# Get EPG data from HCN
 | 
			
		||||
def GetEPGFromHcn(ChannelInfo):
 | 
			
		||||
    ChannelId = ChannelInfo[0]
 | 
			
		||||
    ChannelName = ChannelInfo[1]
 | 
			
		||||
    ServiceId =  ChannelInfo[3]
 | 
			
		||||
    epginfo = []
 | 
			
		||||
    url = 'http://m.hcn.co.kr/sch_ScheduleList.action'
 | 
			
		||||
    for k in range(period):
 | 
			
		||||
        day = today + datetime.timedelta(days=k)
 | 
			
		||||
        params = {'ch_id': ServiceId, 'onairdate': day, '_':  int(time.time()*1000)}
 | 
			
		||||
        try:
 | 
			
		||||
            response = requests.get(url, params=params, headers=ua, timeout=timeout)
 | 
			
		||||
            response.raise_for_status()
 | 
			
		||||
            html_data = response.content
 | 
			
		||||
            data = html_data
 | 
			
		||||
            strainer = SoupStrainer('li')
 | 
			
		||||
            soup = BeautifulSoup(data, htmlparser, parse_only=strainer, from_encoding='utf-8')
 | 
			
		||||
            html =  soup.find_all('li') if soup.find_all('li') else ''
 | 
			
		||||
            if(html) :
 | 
			
		||||
                for row in html:
 | 
			
		||||
                    startTime = endTime = programName = subprogramName = desc = actors = producers = category = episode = ''
 | 
			
		||||
                    rebroadcast = False
 | 
			
		||||
                    rating = 0
 | 
			
		||||
                    if 'noData' in row['class']:
 | 
			
		||||
                        continue
 | 
			
		||||
                    startTime = str(day) + ' ' + row.find('span', {'class':'progTime'}).text.strip()
 | 
			
		||||
                    startTime = datetime.datetime.strptime(startTime, '%Y-%m-%d %H:%M')
 | 
			
		||||
                    startTime = startTime.strftime('%Y%m%d%H%M%S')
 | 
			
		||||
                    programName = row.find('span', {'class':'progTitle'}).text.decode('string_escape').strip()
 | 
			
		||||
                    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
 | 
			
		||||
                        grade = re.match('([\d,]+)',image['alt'])
 | 
			
		||||
                        if not (grade is None): rating = int(grade.group(1))
 | 
			
		||||
                    #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)
 | 
			
		||||
        except ValueError:
 | 
			
		||||
            if(debug): printError(ChannelName + CONTENT_ERROR)
 | 
			
		||||
            else: pass
 | 
			
		||||
        except (requests.exceptions.RequestException) as e:
 | 
			
		||||
            if(debug): printError(ChannelName + str(e))
 | 
			
		||||
            else: pass
 | 
			
		||||
    if(epginfo) :
 | 
			
		||||
        epgzip(epginfo)
 | 
			
		||||
 | 
			
		||||
# Get EPG data from POOQ
 | 
			
		||||
def GetEPGFromPooq(ChannelInfo):
 | 
			
		||||
    ChannelId = ChannelInfo[0]
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user