mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-09 08:30:06 -04:00
Merge https://github.com/Aandree5/epg into nostv-icon-image
This commit is contained in:
commit
1500ed5a21
7 changed files with 2088 additions and 0 deletions
1
SITES.md
1
SITES.md
|
@ -44,6 +44,7 @@
|
|||
<tr><td><a href="sites/dna.fi">dna.fi</a></td><td align="right">122</td><td align="right">0</td><td align="center">🟢</td><td></td></tr>
|
||||
<tr><td><a href="sites/dsmart.com.tr">dsmart.com.tr</a></td><td align="right">104</td><td align="right">90</td><td align="center">🟢</td><td></td></tr>
|
||||
<tr><td><a href="sites/dstv.com">dstv.com</a></td><td align="right">6983</td><td align="right">181</td><td align="center">🟢</td><td></td></tr>
|
||||
<tr><td><a href="sites/dtv8.net">dtv8.net</a></td><td align="right">1</td><td align="right">1</td><td align="center">🟢</td><td></td></tr>
|
||||
<tr><td><a href="sites/elcinema.com">elcinema.com</a></td><td align="right">224</td><td align="right">193</td><td align="center">🟢</td><td></td></tr>
|
||||
<tr><td><a href="sites/ena.skylifetv.co.kr">ena.skylifetv.co.kr</a></td><td align="right">6</td><td align="right">6</td><td align="center">🟢</td><td></td></tr>
|
||||
<tr><td><a href="sites/energeek.cl">energeek.cl</a></td><td align="right">6</td><td align="right">3</td><td align="center">🟢</td><td></td></tr>
|
||||
|
|
955
sites/dtv8.net/__data__/content_fri.html
Normal file
955
sites/dtv8.net/__data__/content_fri.html
Normal file
File diff suppressed because one or more lines are too long
944
sites/dtv8.net/__data__/content_sat.html
Normal file
944
sites/dtv8.net/__data__/content_sat.html
Normal file
File diff suppressed because one or more lines are too long
4
sites/dtv8.net/dtv8.net.channels.xml
Normal file
4
sites/dtv8.net/dtv8.net.channels.xml
Normal file
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<channels>
|
||||
<channel site="dtv8.net" lang="en" xmltv_id="DTV8.gy" site_id="#">DTV-8</channel>
|
||||
</channels>
|
90
sites/dtv8.net/dtv8.net.config.js
Normal file
90
sites/dtv8.net/dtv8.net.config.js
Normal file
|
@ -0,0 +1,90 @@
|
|||
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: 'dtv8.net',
|
||||
days: 2,
|
||||
url({ date }) {
|
||||
const day = date.format('dddd')
|
||||
|
||||
return `https://dtv8.net/tv-listings/${day.toLowerCase()}/`
|
||||
},
|
||||
parser({ content, date }) {
|
||||
let programs = []
|
||||
|
||||
const items = parseItems(content)
|
||||
items.forEach(item => {
|
||||
const $item = cheerio.load(item)
|
||||
let prev = programs[programs.length - 1]
|
||||
let start = parseStart($item, date)
|
||||
if (prev) {
|
||||
if (start < prev.start) {
|
||||
start = start.add(1, 'd')
|
||||
date = date.add(1, 'd')
|
||||
}
|
||||
prev.stop = start
|
||||
}
|
||||
const stop = start.add(30, 'm')
|
||||
|
||||
programs.push({
|
||||
title: parseTitle($item),
|
||||
description: parseDescription($item),
|
||||
image: parseImage($item),
|
||||
start,
|
||||
stop
|
||||
})
|
||||
})
|
||||
|
||||
return programs
|
||||
},
|
||||
channels() {
|
||||
return []
|
||||
}
|
||||
}
|
||||
|
||||
function parseTitle($item) {
|
||||
return $item(
|
||||
'td:nth-child(2) > strong:nth-child(1),td:nth-child(2) > span > strong,td:nth-child(2) > span > b'
|
||||
).text()
|
||||
}
|
||||
|
||||
function parseDescription($item) {
|
||||
return (
|
||||
$item(
|
||||
'td:nth-child(2) > strong:nth-child(3) > span,td:nth-child(2) > p:nth-child(3) > strong > span'
|
||||
).text() || null
|
||||
)
|
||||
}
|
||||
|
||||
function parseImage($item) {
|
||||
return $item('td:nth-child(1) > img.size-full').attr('src') || null
|
||||
}
|
||||
|
||||
function parseStart($item, date) {
|
||||
const time = $item('td:nth-child(1)').text()
|
||||
|
||||
return dayjs.tz(
|
||||
`${date.format('YYYY-MM-DD')} ${time}`,
|
||||
'YYYY-MM-DD HH:mm [hrs.]',
|
||||
'America/Guyana'
|
||||
)
|
||||
}
|
||||
|
||||
function parseItems(content) {
|
||||
const $ = cheerio.load(content)
|
||||
|
||||
return $('table tr')
|
||||
.filter((i, el) => {
|
||||
const firstColumn = $(el).find('td').text()
|
||||
|
||||
return Boolean(firstColumn) && !firstColumn.includes('Time')
|
||||
})
|
||||
.toArray()
|
||||
}
|
79
sites/dtv8.net/dtv8.net.test.js
Normal file
79
sites/dtv8.net/dtv8.net.test.js
Normal file
|
@ -0,0 +1,79 @@
|
|||
const { parser, url } = require('./dtv8.net.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('2025-02-21', 'YYYY-MM-DD').startOf('d')
|
||||
|
||||
it('can generate valid url', () => {
|
||||
expect(url({ date })).toBe('https://dtv8.net/tv-listings/friday/')
|
||||
})
|
||||
|
||||
it('can parse response for friday', () => {
|
||||
const content = fs.readFileSync(path.resolve(__dirname, '__data__/content_fri.html'))
|
||||
|
||||
let results = parser({ content, date })
|
||||
results = results.map(p => {
|
||||
p.start = p.start.toJSON()
|
||||
p.stop = p.stop.toJSON()
|
||||
|
||||
return p
|
||||
})
|
||||
|
||||
expect(results.length).toBe(18)
|
||||
expect(results[9]).toMatchObject({
|
||||
title: 'Smallville',
|
||||
image: 'http://dtv8.net/wp-content/uploads/71P0aShCBXL._SL1300_.jpg',
|
||||
description:
|
||||
'A young Clark Kent struggles to find his place in the world as he learns to harness his alien powers for good and deals with the typical troubles of teenage life in Smallville, Kansas.',
|
||||
start: '2025-02-21T21:00:00.000Z',
|
||||
stop: '2025-02-21T22:00:00.000Z'
|
||||
})
|
||||
expect(results[15]).toMatchObject({
|
||||
title: 'Law & Order',
|
||||
image: null,
|
||||
description:
|
||||
'In God We Trust: A young lawyer with a secret past is found dead; Price and Baxter debate the pros and cons of prison as a punishment versus alternative justice options.',
|
||||
start: '2025-02-22T01:45:00.000Z',
|
||||
stop: '2025-02-22T02:30:00.000Z'
|
||||
})
|
||||
})
|
||||
|
||||
it('can parse response for saturday', () => {
|
||||
const date = dayjs.utc('2025-02-22', 'YYYY-MM-DD').startOf('d')
|
||||
const content = fs.readFileSync(path.resolve(__dirname, '__data__/content_sat.html'))
|
||||
|
||||
let results = parser({ content, date })
|
||||
results = results.map(p => {
|
||||
p.start = p.start.toJSON()
|
||||
p.stop = p.stop.toJSON()
|
||||
|
||||
return p
|
||||
})
|
||||
|
||||
expect(results.length).toBe(11)
|
||||
expect(results[0]).toMatchObject({
|
||||
title: 'Sign On',
|
||||
image: null,
|
||||
description: null,
|
||||
start: '2025-02-22T13:55:00.000Z',
|
||||
stop: '2025-02-22T14:00:00.000Z'
|
||||
})
|
||||
expect(results[10]).toMatchObject({
|
||||
title: 'Sign Off',
|
||||
image: null,
|
||||
description: null,
|
||||
start: '2025-02-23T04:00:00.000Z',
|
||||
stop: '2025-02-23T04:30:00.000Z'
|
||||
})
|
||||
})
|
||||
|
||||
it('can handle empty guide', () => {
|
||||
const results = parser({ content: '' })
|
||||
|
||||
expect(results).toMatchObject([])
|
||||
})
|
15
sites/dtv8.net/readme.md
Normal file
15
sites/dtv8.net/readme.md
Normal file
|
@ -0,0 +1,15 @@
|
|||
# dtv8.net
|
||||
|
||||
https://dtv8.net/tv-listings/
|
||||
|
||||
### Download the guide
|
||||
|
||||
```sh
|
||||
npm run grab --- --site=dtv8.net
|
||||
```
|
||||
|
||||
### Test
|
||||
|
||||
```sh
|
||||
npm test --- dtv8.net
|
||||
```
|
Loading…
Add table
Add a link
Reference in a new issue