mirror of
https://github.com/iptv-org/epg
synced 2026-03-21 19:30:52 -04:00
Merge pull request #2999 from iptv-org/add-vantagetv.ee
Add vantagetv.ee
This commit is contained in:
1069
sites/vantagetv.ee/__data__/content.xml
Normal file
1069
sites/vantagetv.ee/__data__/content.xml
Normal file
File diff suppressed because it is too large
Load Diff
15
sites/vantagetv.ee/readme.md
Normal file
15
sites/vantagetv.ee/readme.md
Normal file
@@ -0,0 +1,15 @@
|
||||
# vantagetv.ee
|
||||
|
||||
https://vantagetv.ee/epg.xml
|
||||
|
||||
### Download the guide
|
||||
|
||||
```sh
|
||||
npm run grab --- --site=vantagetv.ee
|
||||
```
|
||||
|
||||
### Test
|
||||
|
||||
```sh
|
||||
npm test --- vantagetv.ee
|
||||
```
|
||||
6
sites/vantagetv.ee/vantagetv.ee.channels.xml
Normal file
6
sites/vantagetv.ee/vantagetv.ee.channels.xml
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<channels>
|
||||
<channel site="vantagetv.ee" site_id="vmusic" lang="en" xmltv_id="VantageMusic.ee@SD">Vantage Music</channel>
|
||||
<channel site="vantagetv.ee" site_id="vdance" lang="en" xmltv_id="">Vantage Dance</channel>
|
||||
<channel site="vantagetv.ee" site_id="vrock" lang="en" xmltv_id="">Vantage Rock</channel>
|
||||
</channels>
|
||||
27
sites/vantagetv.ee/vantagetv.ee.config.js
Normal file
27
sites/vantagetv.ee/vantagetv.ee.config.js
Normal file
@@ -0,0 +1,27 @@
|
||||
const parser = require('epg-parser')
|
||||
|
||||
module.exports = {
|
||||
site: 'vantagetv.ee',
|
||||
days: 2,
|
||||
url: 'http://vantagetv.ee/epg.xml',
|
||||
parser: function ({ content, channel, date }) {
|
||||
let programs = []
|
||||
const items = parseItems(content, channel, date)
|
||||
items.forEach(item => {
|
||||
programs.push({
|
||||
title: item.title?.[0]?.value,
|
||||
description: item.desc?.[0]?.value,
|
||||
start: item.start,
|
||||
stop: item.stop
|
||||
})
|
||||
})
|
||||
|
||||
return programs
|
||||
}
|
||||
}
|
||||
|
||||
function parseItems(content, channel, date) {
|
||||
const { programs } = parser.parse(content)
|
||||
|
||||
return programs.filter(p => p.channel === channel.site_id && date.isSame(p.start, 'day'))
|
||||
}
|
||||
41
sites/vantagetv.ee/vantagetv.ee.test.js
Normal file
41
sites/vantagetv.ee/vantagetv.ee.test.js
Normal file
@@ -0,0 +1,41 @@
|
||||
const { parser, url } = require('./vantagetv.ee.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('2026-02-05', 'YYYY-MM-DD').startOf('d')
|
||||
const channel = { site_id: 'vrock' }
|
||||
|
||||
it('can generate valid url', () => {
|
||||
expect(url).toBe('http://vantagetv.ee/epg.xml')
|
||||
})
|
||||
|
||||
it('can parse response', () => {
|
||||
const content = fs.readFileSync(path.resolve(__dirname, '__data__/content.xml'))
|
||||
|
||||
const results = parser({ content, channel, date })
|
||||
|
||||
expect(results.length).toBe(3)
|
||||
expect(results[0]).toMatchObject({
|
||||
title: 'Breakfast with Vantage Rock',
|
||||
description: 'Get ready for your day with Vantage Rock',
|
||||
start: '2026-02-05T04:00:00.000Z',
|
||||
stop: '2026-02-05T08:00:00.000Z'
|
||||
})
|
||||
expect(results[2]).toMatchObject({
|
||||
title: 'Rock All Night',
|
||||
description: 'It might be late, but that's no reason to stop!',
|
||||
start: '2026-02-05T22:00:00.000Z',
|
||||
stop: '2026-02-06T04:00:00.000Z'
|
||||
})
|
||||
})
|
||||
|
||||
it('can handle empty guide', () => {
|
||||
const results = parser({ content: '' })
|
||||
|
||||
expect(results).toMatchObject([])
|
||||
})
|
||||
Reference in New Issue
Block a user