mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-10 09:00:07 -04:00
Merge pull request #1823 from iptv-org/add-ena.skylifetv.co.kr
Add guide from ena.skylifetv.co.kr
This commit is contained in:
commit
97f59588f0
6 changed files with 6505 additions and 0 deletions
17
.github/workflows/ena.skylifetv.co.kr.yml
vendored
Normal file
17
.github/workflows/ena.skylifetv.co.kr.yml
vendored
Normal file
|
@ -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 }}
|
3274
sites/ena.skylifetv.co.kr/__data__/content.html
Normal file
3274
sites/ena.skylifetv.co.kr/__data__/content.html
Normal file
File diff suppressed because it is too large
Load diff
3076
sites/ena.skylifetv.co.kr/__data__/no_content.html
Normal file
3076
sites/ena.skylifetv.co.kr/__data__/no_content.html
Normal file
File diff suppressed because it is too large
Load diff
11
sites/ena.skylifetv.co.kr/ena.skylifetv.co.kr.channels.xml
Normal file
11
sites/ena.skylifetv.co.kr/ena.skylifetv.co.kr.channels.xml
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<site site="ena.skylifetv.co.kr">
|
||||||
|
<channels>
|
||||||
|
<channel lang="ko" xmltv_id="ENA.kr" site_id="ENA">ENA</channel>
|
||||||
|
<channel lang="ko" xmltv_id="ENAPLAY.kr" site_id="ENA_PLAY">ENA PLAY</channel>
|
||||||
|
<channel lang="ko" xmltv_id="KidsTalkTalkPlus.kr" site_id="kidstalktalkplus">kids talk talk plus</channel>
|
||||||
|
<channel lang="ko" xmltv_id="OLIFE.kr" site_id="OLIFE">OLIFE</channel>
|
||||||
|
<channel lang="ko" xmltv_id="ONCE.kr" site_id="ONCE">ONCE</channel>
|
||||||
|
<channel lang="ko" xmltv_id="skyUHD.kr" site_id="skyUHD">skyUHD</channel>
|
||||||
|
</channels>
|
||||||
|
</site>
|
68
sites/ena.skylifetv.co.kr/ena.skylifetv.co.kr.config.js
Normal file
68
sites/ena.skylifetv.co.kr/ena.skylifetv.co.kr.config.js
Normal file
|
@ -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()
|
||||||
|
}
|
59
sites/ena.skylifetv.co.kr/ena.skylifetv.co.kr.test.js
Normal file
59
sites/ena.skylifetv.co.kr/ena.skylifetv.co.kr.test.js
Normal file
|
@ -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([])
|
||||||
|
})
|
Loading…
Add table
Add a link
Reference in a new issue