mirror of
https://github.com/iptv-org/epg
synced 2026-09-14 13:06:24 -04:00
Replace LF line endings with CRLF
This commit is contained in:
@@ -1,19 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<channels>
|
||||
<channel site="novasports.gr" lang="el" xmltv_id="Eurosport1.fr@Greece" site_id="Eurosport 1 HD">Eurosport 1 HD</channel>
|
||||
<channel site="novasports.gr" lang="el" xmltv_id="Eurosport2.fr@Greece" site_id="Eurosport 2 HD">Eurosport 2 HD</channel>
|
||||
<channel site="novasports.gr" lang="el" xmltv_id="Novasports1.gr" site_id="Novasports1HD">Novasports1HD</channel>
|
||||
<channel site="novasports.gr" lang="el" xmltv_id="Novasports2.gr" site_id="Novasports2HD">Novasports2HD</channel>
|
||||
<channel site="novasports.gr" lang="el" xmltv_id="Novasports3.gr" site_id="Novasports3HD">Novasports3HD</channel>
|
||||
<channel site="novasports.gr" lang="el" xmltv_id="Novasports4.gr" site_id="Novasports4HD">Novasports4HD</channel>
|
||||
<channel site="novasports.gr" lang="el" xmltv_id="Novasports5.gr" site_id="Novasports5HD">Novasports5HD</channel>
|
||||
<channel site="novasports.gr" lang="el" xmltv_id="Novasports6.gr" site_id="Novasports6HD">Novasports6HD</channel>
|
||||
<channel site="novasports.gr" lang="el" xmltv_id="NovasportsExtra1.gr" site_id="Novasports Εxtra1">Novasports Εxtra1</channel>
|
||||
<channel site="novasports.gr" lang="el" xmltv_id="NovasportsExtra2.gr" site_id="Novasports Extra2">Novasports Extra2</channel>
|
||||
<channel site="novasports.gr" lang="el" xmltv_id="NovasportsExtra3.gr" site_id="Novasports Extra3">Novasports Extra3</channel>
|
||||
<channel site="novasports.gr" lang="el" xmltv_id="NovasportsExtra4.gr" site_id="Novasports Extra4">Novasports Extra4</channel>
|
||||
<channel site="novasports.gr" lang="el" xmltv_id="NovasportsNews.gr" site_id="ΝovasportsNews">ΝovasportsNews</channel>
|
||||
<channel site="novasports.gr" lang="el" xmltv_id="NovasportsPremierLeague.gr" site_id="Novasports Premier League">Novasports Premier League</channel>
|
||||
<channel site="novasports.gr" lang="el" xmltv_id="NovasportsPrime.gr" site_id="Novasports Prime">Novasports Prime</channel>
|
||||
<channel site="novasports.gr" lang="el" xmltv_id="NovasportsStart.gr" site_id="ΝovasportsStart">ΝovasportsStart</channel>
|
||||
</channels>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<channels>
|
||||
<channel site="novasports.gr" lang="el" xmltv_id="Eurosport1.fr@Greece" site_id="Eurosport 1 HD">Eurosport 1 HD</channel>
|
||||
<channel site="novasports.gr" lang="el" xmltv_id="Eurosport2.fr@Greece" site_id="Eurosport 2 HD">Eurosport 2 HD</channel>
|
||||
<channel site="novasports.gr" lang="el" xmltv_id="Novasports1.gr" site_id="Novasports1HD">Novasports1HD</channel>
|
||||
<channel site="novasports.gr" lang="el" xmltv_id="Novasports2.gr" site_id="Novasports2HD">Novasports2HD</channel>
|
||||
<channel site="novasports.gr" lang="el" xmltv_id="Novasports3.gr" site_id="Novasports3HD">Novasports3HD</channel>
|
||||
<channel site="novasports.gr" lang="el" xmltv_id="Novasports4.gr" site_id="Novasports4HD">Novasports4HD</channel>
|
||||
<channel site="novasports.gr" lang="el" xmltv_id="Novasports5.gr" site_id="Novasports5HD">Novasports5HD</channel>
|
||||
<channel site="novasports.gr" lang="el" xmltv_id="Novasports6.gr" site_id="Novasports6HD">Novasports6HD</channel>
|
||||
<channel site="novasports.gr" lang="el" xmltv_id="NovasportsExtra1.gr" site_id="Novasports Εxtra1">Novasports Εxtra1</channel>
|
||||
<channel site="novasports.gr" lang="el" xmltv_id="NovasportsExtra2.gr" site_id="Novasports Extra2">Novasports Extra2</channel>
|
||||
<channel site="novasports.gr" lang="el" xmltv_id="NovasportsExtra3.gr" site_id="Novasports Extra3">Novasports Extra3</channel>
|
||||
<channel site="novasports.gr" lang="el" xmltv_id="NovasportsExtra4.gr" site_id="Novasports Extra4">Novasports Extra4</channel>
|
||||
<channel site="novasports.gr" lang="el" xmltv_id="NovasportsNews.gr" site_id="ΝovasportsNews">ΝovasportsNews</channel>
|
||||
<channel site="novasports.gr" lang="el" xmltv_id="NovasportsPremierLeague.gr" site_id="Novasports Premier League">Novasports Premier League</channel>
|
||||
<channel site="novasports.gr" lang="el" xmltv_id="NovasportsPrime.gr" site_id="Novasports Prime">Novasports Prime</channel>
|
||||
<channel site="novasports.gr" lang="el" xmltv_id="NovasportsStart.gr" site_id="ΝovasportsStart">ΝovasportsStart</channel>
|
||||
</channels>
|
||||
|
||||
@@ -1,87 +1,87 @@
|
||||
const axios = require('axios')
|
||||
const cheerio = require('cheerio')
|
||||
const dayjs = require('dayjs')
|
||||
const utc = require('dayjs/plugin/utc')
|
||||
const timezone = require('dayjs/plugin/timezone')
|
||||
|
||||
dayjs.extend(utc)
|
||||
dayjs.extend(timezone)
|
||||
|
||||
module.exports = {
|
||||
site: 'novasports.gr',
|
||||
days: 2,
|
||||
url: function ({ date }) {
|
||||
return `https://www.novasports.gr/wp-admin/admin-ajax.php?action=nova_get_template&template=tv-program/broadcast&dt=${date.format(
|
||||
'YYYY-MM-DD'
|
||||
)}`
|
||||
},
|
||||
parser: function ({ content, channel, date }) {
|
||||
let programs = []
|
||||
const items = parseItems(content, channel)
|
||||
items.forEach(item => {
|
||||
const $item = cheerio.load(item)
|
||||
const prev = programs[programs.length - 1]
|
||||
let start = parseStart($item, date)
|
||||
let stop = start.add(30, 'm')
|
||||
if (prev) {
|
||||
if (start.isBefore(prev.start)) {
|
||||
start = start.add(1, 'd')
|
||||
stop = stop.add(1, 'd')
|
||||
}
|
||||
prev.stop = start
|
||||
}
|
||||
programs.push({
|
||||
title: parseTitle($item),
|
||||
description: parseDescription($item),
|
||||
start,
|
||||
stop
|
||||
})
|
||||
})
|
||||
|
||||
return programs
|
||||
},
|
||||
async channels() {
|
||||
const html = await axios
|
||||
.get(
|
||||
'https://www.novasports.gr/wp-admin/admin-ajax.php?action=nova_get_template&template=tv-program/broadcast&dt=2022-10-29'
|
||||
)
|
||||
.then(r => r.data)
|
||||
.catch(console.log)
|
||||
const $ = cheerio.load(html)
|
||||
const items = $(
|
||||
'#mc-broadcast-content:nth-child(2) > div > #channelist-slider > div.channelist-wrapper.slider-wrapper.content > div > div'
|
||||
).toArray()
|
||||
return items.map(item => {
|
||||
const name = $(item).find('.channel').text().trim()
|
||||
|
||||
return {
|
||||
lang: 'el',
|
||||
site_id: name,
|
||||
name
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
function parseTitle($item) {
|
||||
return $item('.title').text().trim()
|
||||
}
|
||||
|
||||
function parseDescription($item) {
|
||||
return $item('.subtitle').text().trim()
|
||||
}
|
||||
|
||||
function parseStart($item, date) {
|
||||
const timeString = $item('.time').text().trim()
|
||||
|
||||
return dayjs.tz(`${date.format('YYYY-MM-DD')} ${timeString}`, 'YYYY-MM-DD HH:mm', 'Europe/Athens')
|
||||
}
|
||||
|
||||
function parseItems(content, channel) {
|
||||
const $ = cheerio.load(content)
|
||||
const $channelElement = $(
|
||||
`#mc-broadcast-content:nth-child(2) > div > #channelist-slider > div.channelist-wrapper.slider-wrapper.content > div > div:contains("${channel.site_id}")`
|
||||
)
|
||||
|
||||
return $channelElement.find('.channel-program > div').toArray()
|
||||
}
|
||||
const axios = require('axios')
|
||||
const cheerio = require('cheerio')
|
||||
const dayjs = require('dayjs')
|
||||
const utc = require('dayjs/plugin/utc')
|
||||
const timezone = require('dayjs/plugin/timezone')
|
||||
|
||||
dayjs.extend(utc)
|
||||
dayjs.extend(timezone)
|
||||
|
||||
module.exports = {
|
||||
site: 'novasports.gr',
|
||||
days: 2,
|
||||
url: function ({ date }) {
|
||||
return `https://www.novasports.gr/wp-admin/admin-ajax.php?action=nova_get_template&template=tv-program/broadcast&dt=${date.format(
|
||||
'YYYY-MM-DD'
|
||||
)}`
|
||||
},
|
||||
parser: function ({ content, channel, date }) {
|
||||
let programs = []
|
||||
const items = parseItems(content, channel)
|
||||
items.forEach(item => {
|
||||
const $item = cheerio.load(item)
|
||||
const prev = programs[programs.length - 1]
|
||||
let start = parseStart($item, date)
|
||||
let stop = start.add(30, 'm')
|
||||
if (prev) {
|
||||
if (start.isBefore(prev.start)) {
|
||||
start = start.add(1, 'd')
|
||||
stop = stop.add(1, 'd')
|
||||
}
|
||||
prev.stop = start
|
||||
}
|
||||
programs.push({
|
||||
title: parseTitle($item),
|
||||
description: parseDescription($item),
|
||||
start,
|
||||
stop
|
||||
})
|
||||
})
|
||||
|
||||
return programs
|
||||
},
|
||||
async channels() {
|
||||
const html = await axios
|
||||
.get(
|
||||
'https://www.novasports.gr/wp-admin/admin-ajax.php?action=nova_get_template&template=tv-program/broadcast&dt=2022-10-29'
|
||||
)
|
||||
.then(r => r.data)
|
||||
.catch(console.log)
|
||||
const $ = cheerio.load(html)
|
||||
const items = $(
|
||||
'#mc-broadcast-content:nth-child(2) > div > #channelist-slider > div.channelist-wrapper.slider-wrapper.content > div > div'
|
||||
).toArray()
|
||||
return items.map(item => {
|
||||
const name = $(item).find('.channel').text().trim()
|
||||
|
||||
return {
|
||||
lang: 'el',
|
||||
site_id: name,
|
||||
name
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
function parseTitle($item) {
|
||||
return $item('.title').text().trim()
|
||||
}
|
||||
|
||||
function parseDescription($item) {
|
||||
return $item('.subtitle').text().trim()
|
||||
}
|
||||
|
||||
function parseStart($item, date) {
|
||||
const timeString = $item('.time').text().trim()
|
||||
|
||||
return dayjs.tz(`${date.format('YYYY-MM-DD')} ${timeString}`, 'YYYY-MM-DD HH:mm', 'Europe/Athens')
|
||||
}
|
||||
|
||||
function parseItems(content, channel) {
|
||||
const $ = cheerio.load(content)
|
||||
const $channelElement = $(
|
||||
`#mc-broadcast-content:nth-child(2) > div > #channelist-slider > div.channelist-wrapper.slider-wrapper.content > div > div:contains("${channel.site_id}")`
|
||||
)
|
||||
|
||||
return $channelElement.find('.channel-program > div').toArray()
|
||||
}
|
||||
|
||||
@@ -1,46 +1,46 @@
|
||||
const { parser, url } = require('./novasports.gr.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('2022-10-29', 'YYYY-MM-DD').startOf('d')
|
||||
const channel = {
|
||||
site_id: 'Novasports Premier League',
|
||||
xmltv_id: 'NovasportsPremierLeague.gr'
|
||||
}
|
||||
|
||||
it('can generate valid url', () => {
|
||||
expect(url({ date })).toBe(
|
||||
'https://www.novasports.gr/wp-admin/admin-ajax.php?action=nova_get_template&template=tv-program/broadcast&dt=2022-10-29'
|
||||
)
|
||||
})
|
||||
|
||||
it('can parse response', () => {
|
||||
const content = fs.readFileSync(path.resolve(__dirname, '__data__/content.html'))
|
||||
const results = parser({ content, channel, date }).map(p => {
|
||||
p.start = p.start.toJSON()
|
||||
p.stop = p.stop.toJSON()
|
||||
return p
|
||||
})
|
||||
|
||||
expect(results[0]).toMatchObject({
|
||||
start: '2022-10-29T07:00:00.000Z',
|
||||
stop: '2022-10-29T07:30:00.000Z',
|
||||
title: 'Classic Match',
|
||||
description: 'Τσέλσι - Μάντσεστερ Γ. (1999/00)'
|
||||
})
|
||||
})
|
||||
|
||||
it('can handle empty guide', () => {
|
||||
const results = parser({
|
||||
content: fs.readFileSync(path.resolve(__dirname, '__data__/no_content.html')),
|
||||
channel,
|
||||
date
|
||||
})
|
||||
|
||||
expect(results).toMatchObject([])
|
||||
})
|
||||
const { parser, url } = require('./novasports.gr.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('2022-10-29', 'YYYY-MM-DD').startOf('d')
|
||||
const channel = {
|
||||
site_id: 'Novasports Premier League',
|
||||
xmltv_id: 'NovasportsPremierLeague.gr'
|
||||
}
|
||||
|
||||
it('can generate valid url', () => {
|
||||
expect(url({ date })).toBe(
|
||||
'https://www.novasports.gr/wp-admin/admin-ajax.php?action=nova_get_template&template=tv-program/broadcast&dt=2022-10-29'
|
||||
)
|
||||
})
|
||||
|
||||
it('can parse response', () => {
|
||||
const content = fs.readFileSync(path.resolve(__dirname, '__data__/content.html'))
|
||||
const results = parser({ content, channel, date }).map(p => {
|
||||
p.start = p.start.toJSON()
|
||||
p.stop = p.stop.toJSON()
|
||||
return p
|
||||
})
|
||||
|
||||
expect(results[0]).toMatchObject({
|
||||
start: '2022-10-29T07:00:00.000Z',
|
||||
stop: '2022-10-29T07:30:00.000Z',
|
||||
title: 'Classic Match',
|
||||
description: 'Τσέλσι - Μάντσεστερ Γ. (1999/00)'
|
||||
})
|
||||
})
|
||||
|
||||
it('can handle empty guide', () => {
|
||||
const results = parser({
|
||||
content: fs.readFileSync(path.resolve(__dirname, '__data__/no_content.html')),
|
||||
channel,
|
||||
date
|
||||
})
|
||||
|
||||
expect(results).toMatchObject([])
|
||||
})
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
# novasports.gr
|
||||
|
||||
https://www.novasports.gr/tv-program/
|
||||
|
||||
### Download the guide
|
||||
|
||||
```sh
|
||||
npm run grab --- --site=novasports.gr
|
||||
```
|
||||
|
||||
### Update channel list
|
||||
|
||||
```sh
|
||||
npm run channels:parse --- --config=./sites/novasports.gr/novasports.gr.config.js --output=./sites/novasports.gr/novasports.gr.channels.xml
|
||||
```
|
||||
|
||||
### Test
|
||||
|
||||
```sh
|
||||
npm test --- novasports.gr
|
||||
```
|
||||
# novasports.gr
|
||||
|
||||
https://www.novasports.gr/tv-program/
|
||||
|
||||
### Download the guide
|
||||
|
||||
```sh
|
||||
npm run grab --- --site=novasports.gr
|
||||
```
|
||||
|
||||
### Update channel list
|
||||
|
||||
```sh
|
||||
npm run channels:parse --- --config=./sites/novasports.gr/novasports.gr.config.js --output=./sites/novasports.gr/novasports.gr.channels.xml
|
||||
```
|
||||
|
||||
### Test
|
||||
|
||||
```sh
|
||||
npm test --- novasports.gr
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user