diff --git a/.github/workflows/ena.skylifetv.co.kr.yml b/.github/workflows/ena.skylifetv.co.kr.yml new file mode 100644 index 00000000..d5fcc618 --- /dev/null +++ b/.github/workflows/ena.skylifetv.co.kr.yml @@ -0,0 +1,17 @@ +name: ena.skylifetv.co.kr +on: + schedule: + - cron: '0 3 * * *' + workflow_dispatch: + workflow_run: + workflows: [_trigger] + types: + - completed +jobs: + load: + uses: ./.github/workflows/_load.yml + with: + site: ${{github.workflow}} + secrets: + APP_ID: ${{ secrets.APP_ID }} + APP_PRIVATE_KEY: ${{ secrets.APP_PRIVATE_KEY }} diff --git a/sites/ena.skylifetv.co.kr/__data__/content.html b/sites/ena.skylifetv.co.kr/__data__/content.html new file mode 100644 index 00000000..f8dd1e1c --- /dev/null +++ b/sites/ena.skylifetv.co.kr/__data__/content.html @@ -0,0 +1,3274 @@ + + + + + + + + + + + + + + + + + + + + + + + +ENA [엔터테인먼트 DNA] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+
+
+
+
+
+
+ +
+

ENTERTAINMENT DNA ENA

+

+ skyTV의 모든 오리지널을 한 곳에! 다양한 드라마와 예능 라인업으로 매순간 시청자에게 즐거움을 선사합니다.

+ + +
+
+
+ + + + + +
+
+
+ 편성표 +
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
편성표
시간프로그램 정보장애인등급시간
01:05 + ON AIR + 법쩐 6화 + ON AIR-1575
02:20 + ON AIR + 남이 될 수 있을까 3화 + ON AIR-1575
03:35 + ON AIR + 남이 될 수 있을까 4화 + ON AIR-1575
04:50 + ON AIR + 나는 SOLO 81화 + ON AIR-1590
06:20 + ON AIR + 법쩐 5화 + ON AIR-1580
07:40 + ON AIR + 법쩐 6화 + ON AIR-1575
08:55 + ON AIR + 남이 될 수 있을까 3화 + ON AIR-1575
10:10 + ON AIR + 남이 될 수 있을까 4화 + ON AIR-1575
11:25 + ON AIR + 동백꽃 필 무렵 17화 + ON AIR-1575
12:40 + ON AIR + 동백꽃 필 무렵 18화 + ON AIR-1580
14:00 + ON AIR + 남이 될 수 있을까 3화 + ON AIR-1575
15:15 + ON AIR + 남이 될 수 있을까 4화 + ON AIR-1575
16:30 + ON AIR + 동백꽃 필 무렵 19화 + ON AIR-1580
17:50 + ON AIR + 동백꽃 필 무렵 20화 + ON AIR-1585
19:15 + ON AIR + 법쩐 6화 + ON AIR-1575
20:30 + ON AIR + 명동사랑방 1화 + ON AIR-1585
21:55 + ON AIR + 남이 될 수 있을까 3화 + ON AIR-1575
23:10 + ON AIR + 남이 될 수 있을까 4화 + ON AIR-1575
+
+ 편성표 자세히 보기 +
+
+
+
+
+
+ 채널번호 찾기 +
+ + + + + + +
+
+
+
+ +
+
+ +
+ +
+
+ +
+ +
+
+
+ IPTV +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
IPTV 채널번호
구분채널번호구분채널번호
Genie TV(KT)1B tv(SKB)40
U+ tv(LG)72
+
+
+
+
+ 위성방송 +
+
+ + + + + + + + + + + + + + + + + + + + + +
위성방송 채널번호
구분채널번호구분채널번호
skylife1
+
+
+
+
+ 케이블 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
케이블 채널번호
구분채널번호구분채널번호
LG헬로비전45딜라이브(DLIVE)58
B tv 알뜰57씨엠비(CMB)37
HCN996
+
+
+
+
+

지역 방송을 시청하시는 분들은 아래 고객센터로 문의 바랍니다.

+

+ LG헬로비전 1588-1000 / 딜라이브 1644-1100 / B tv 알뜰 1877-7000 / CMB 1544-3434 / HCN 1877-8000 +

+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + diff --git a/sites/ena.skylifetv.co.kr/__data__/no_content.html b/sites/ena.skylifetv.co.kr/__data__/no_content.html new file mode 100644 index 00000000..0ae17cc8 --- /dev/null +++ b/sites/ena.skylifetv.co.kr/__data__/no_content.html @@ -0,0 +1,3076 @@ + + + + + + + + + + + + + + + + + + + + + + + +ENA [엔터테인먼트 DNA] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+
+
+
+
+
+
+ +
+

ENTERTAINMENT DNA ENA

+

+ skyTV의 모든 오리지널을 한 곳에! 다양한 드라마와 예능 라인업으로 매순간 시청자에게 즐거움을 선사합니다.

+ + +
+
+
+ + + + + +
+
+
+ 편성표 +
+
+ +
+ + + + + + + + + + + + + +
편성표
시간프로그램 정보장애인등급시간
+
+ 편성표 자세히 보기 +
+
+
+
+
+
+ 채널번호 찾기 +
+ + + + + + +
+
+
+
+ +
+
+ +
+ +
+
+ +
+ +
+
+
+ IPTV +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
IPTV 채널번호
구분채널번호구분채널번호
Genie TV(KT)1B tv(SKB)40
U+ tv(LG)72
+
+
+
+
+ 위성방송 +
+
+ + + + + + + + + + + + + + + + + + + + + +
위성방송 채널번호
구분채널번호구분채널번호
skylife1
+
+
+
+
+ 케이블 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
케이블 채널번호
구분채널번호구분채널번호
LG헬로비전45딜라이브(DLIVE)58
B tv 알뜰57씨엠비(CMB)37
HCN996
+
+
+
+
+

지역 방송을 시청하시는 분들은 아래 고객센터로 문의 바랍니다.

+

+ LG헬로비전 1588-1000 / 딜라이브 1644-1100 / B tv 알뜰 1877-7000 / CMB 1544-3434 / HCN 1877-8000 +

+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + diff --git a/sites/ena.skylifetv.co.kr/ena.skylifetv.co.kr.channels.xml b/sites/ena.skylifetv.co.kr/ena.skylifetv.co.kr.channels.xml new file mode 100644 index 00000000..a01dc207 --- /dev/null +++ b/sites/ena.skylifetv.co.kr/ena.skylifetv.co.kr.channels.xml @@ -0,0 +1,11 @@ + + + + ENA + ENA PLAY + kids talk talk plus + OLIFE + ONCE + skyUHD + + diff --git a/sites/ena.skylifetv.co.kr/ena.skylifetv.co.kr.config.js b/sites/ena.skylifetv.co.kr/ena.skylifetv.co.kr.config.js new file mode 100644 index 00000000..86e3791f --- /dev/null +++ b/sites/ena.skylifetv.co.kr/ena.skylifetv.co.kr.config.js @@ -0,0 +1,68 @@ +const cheerio = require('cheerio') +const dayjs = require('dayjs') +const utc = require('dayjs/plugin/utc') +const timezone = require('dayjs/plugin/timezone') +const customParseFormat = require('dayjs/plugin/customParseFormat') + +dayjs.extend(utc) +dayjs.extend(timezone) +dayjs.extend(customParseFormat) + +module.exports = { + site: 'ena.skylifetv.co.kr', + days: 2, + url({ channel, date }) { + return `http://ena.skylifetv.co.kr/${channel.site_id}/?day=${date.format('YYYYMMDD')}&sc_dvsn=U` + }, + parser({ content, date }) { + const programs = [] + const items = parseItems(content, date) + items.forEach(item => { + const $item = cheerio.load(item) + const start = parseStart($item, date) + const duration = parseDuration($item) + const stop = start.add(duration, 'm') + programs.push({ + title: parseTitle($item), + rating: parseRating($item), + start, + stop + }) + }) + + return programs + } +} + +function parseTitle($item) { + return $item('.col2 > .tit').text().trim() +} + +function parseRating($item) { + const rating = $item('.col4').text().trim() + + return rating + ? { + system: 'KMRB', + value: rating + } + : null +} + +function parseDuration($item) { + const duration = $item('.col5').text().trim() + + return duration ? parseInt(duration) : 30 +} + +function parseStart($item, date) { + const time = $item('.col1').text().trim() + + return dayjs.tz(`${date.format('YYYY-MM-DD')} ${time}`, 'YYYY-MM-DD HH:mm', 'Asia/Seoul') +} + +function parseItems(content, channel, date) { + const $ = cheerio.load(content) + + return $('.tbl_schedule > tbody > tr').toArray() +} diff --git a/sites/ena.skylifetv.co.kr/ena.skylifetv.co.kr.test.js b/sites/ena.skylifetv.co.kr/ena.skylifetv.co.kr.test.js new file mode 100644 index 00000000..ecf7e5ae --- /dev/null +++ b/sites/ena.skylifetv.co.kr/ena.skylifetv.co.kr.test.js @@ -0,0 +1,59 @@ +// npx epg-grabber --config=sites/ena.skylifetv.co.kr/ena.skylifetv.co.kr.config.js --channels=sites/ena.skylifetv.co.kr/ena.skylifetv.co.kr.channels.xml --output=guide.xml --days=2 + +const { parser, url } = require('./ena.skylifetv.co.kr.config.js') +const fs = require('fs') +const path = require('path') +const dayjs = require('dayjs') +const utc = require('dayjs/plugin/utc') +const customParseFormat = require('dayjs/plugin/customParseFormat') +dayjs.extend(customParseFormat) +dayjs.extend(utc) + +const date = dayjs.utc('2023-01-27', 'YYYY-MM-DD').startOf('d') +const channel = { + site_id: 'ENA', + xmltv_id: 'ENA.kr' +} + +it('can generate valid url', () => { + expect(url({ channel, date })).toBe('http://ena.skylifetv.co.kr/ENA/?day=20230127&sc_dvsn=U') +}) + +it('can parse response', () => { + const content = fs.readFileSync(path.resolve(__dirname, '__data__/content.html'), 'utf8') + let results = parser({ content, date }) + results = results.map(p => { + p.start = p.start.toJSON() + p.stop = p.stop.toJSON() + return p + }) + + expect(results[0]).toMatchObject({ + start: '2023-01-26T16:05:00.000Z', + stop: '2023-01-26T17:20:00.000Z', + title: `법쩐 6화`, + rating: { + system: 'KMRB', + value: '15' + } + }) + + expect(results[17]).toMatchObject({ + start: '2023-01-27T14:10:00.000Z', + stop: '2023-01-27T15:25:00.000Z', + title: `남이 될 수 있을까 4화`, + rating: { + system: 'KMRB', + value: '15' + } + }) +}) + +it('can handle empty guide', () => { + const results = parser({ + date, + content: fs.readFileSync(path.resolve(__dirname, '__data__/no_content.html'), 'utf8') + }) + + expect(results).toMatchObject([]) +})