mirror of
https://github.com/iptv-org/epg
synced 2025-12-16 10:26:41 -05:00
Replace LF line endings with CRLF
This commit is contained in:
@@ -1,20 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<channels>
|
||||
<channel site="raiplay.it" lang="it" xmltv_id="" site_id="raiplay">RAIPLAY</channel>
|
||||
<channel site="raiplay.it" lang="it" xmltv_id="" site_id="raiplay-2">RAIPLAY 2</channel>
|
||||
<channel site="raiplay.it" lang="it" xmltv_id="" site_id="raiplay-3">RAIPLAY 3</channel>
|
||||
<channel site="raiplay.it" lang="it" xmltv_id="" site_id="rai-radio-2">RAI RADIO 2</channel>
|
||||
<channel site="raiplay.it" lang="it" xmltv_id="Rai1.it" site_id="rai-1">RAI 1</channel>
|
||||
<channel site="raiplay.it" lang="it" xmltv_id="Rai2.it" site_id="rai-2">RAI 2</channel>
|
||||
<channel site="raiplay.it" lang="it" xmltv_id="Rai3.it" site_id="rai-3">RAI 3</channel>
|
||||
<channel site="raiplay.it" lang="it" xmltv_id="Rai4.it" site_id="rai-4">RAI 4</channel>
|
||||
<channel site="raiplay.it" lang="it" xmltv_id="Rai5.it" site_id="rai-5">RAI 5</channel>
|
||||
<channel site="raiplay.it" lang="it" xmltv_id="RaiGulp.it" site_id="rai-gulp">RAI GULP</channel>
|
||||
<channel site="raiplay.it" lang="it" xmltv_id="RaiMovie.it" site_id="rai-movie">RAI MOVIE</channel>
|
||||
<channel site="raiplay.it" lang="it" xmltv_id="RaiNews24.it" site_id="rai-news-24">RAI NEWS 24</channel>
|
||||
<channel site="raiplay.it" lang="it" xmltv_id="RaiPremium.it" site_id="rai-premium">RAI PREMIUM</channel>
|
||||
<channel site="raiplay.it" lang="it" xmltv_id="RaiScuola.it" site_id="rai-scuola">RAI SCUOLA</channel>
|
||||
<channel site="raiplay.it" lang="it" xmltv_id="RaiSport.it" site_id="rai-sport">RAI SPORT</channel>
|
||||
<channel site="raiplay.it" lang="it" xmltv_id="RaiStoria.it" site_id="rai-storia">RAI STORIA</channel>
|
||||
<channel site="raiplay.it" lang="it" xmltv_id="RaiYoyo.it" site_id="rai-yoyo">RAI YOYO</channel>
|
||||
</channels>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<channels>
|
||||
<channel site="raiplay.it" lang="it" xmltv_id="" site_id="raiplay">RAIPLAY</channel>
|
||||
<channel site="raiplay.it" lang="it" xmltv_id="" site_id="raiplay-2">RAIPLAY 2</channel>
|
||||
<channel site="raiplay.it" lang="it" xmltv_id="" site_id="raiplay-3">RAIPLAY 3</channel>
|
||||
<channel site="raiplay.it" lang="it" xmltv_id="" site_id="rai-radio-2">RAI RADIO 2</channel>
|
||||
<channel site="raiplay.it" lang="it" xmltv_id="Rai1.it" site_id="rai-1">RAI 1</channel>
|
||||
<channel site="raiplay.it" lang="it" xmltv_id="Rai2.it" site_id="rai-2">RAI 2</channel>
|
||||
<channel site="raiplay.it" lang="it" xmltv_id="Rai3.it" site_id="rai-3">RAI 3</channel>
|
||||
<channel site="raiplay.it" lang="it" xmltv_id="Rai4.it" site_id="rai-4">RAI 4</channel>
|
||||
<channel site="raiplay.it" lang="it" xmltv_id="Rai5.it" site_id="rai-5">RAI 5</channel>
|
||||
<channel site="raiplay.it" lang="it" xmltv_id="RaiGulp.it" site_id="rai-gulp">RAI GULP</channel>
|
||||
<channel site="raiplay.it" lang="it" xmltv_id="RaiMovie.it" site_id="rai-movie">RAI MOVIE</channel>
|
||||
<channel site="raiplay.it" lang="it" xmltv_id="RaiNews24.it" site_id="rai-news-24">RAI NEWS 24</channel>
|
||||
<channel site="raiplay.it" lang="it" xmltv_id="RaiPremium.it" site_id="rai-premium">RAI PREMIUM</channel>
|
||||
<channel site="raiplay.it" lang="it" xmltv_id="RaiScuola.it" site_id="rai-scuola">RAI SCUOLA</channel>
|
||||
<channel site="raiplay.it" lang="it" xmltv_id="RaiSport.it" site_id="rai-sport">RAI SPORT</channel>
|
||||
<channel site="raiplay.it" lang="it" xmltv_id="RaiStoria.it" site_id="rai-storia">RAI STORIA</channel>
|
||||
<channel site="raiplay.it" lang="it" xmltv_id="RaiYoyo.it" site_id="rai-yoyo">RAI YOYO</channel>
|
||||
</channels>
|
||||
|
||||
@@ -1,79 +1,79 @@
|
||||
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(customParseFormat)
|
||||
dayjs.extend(timezone)
|
||||
|
||||
module.exports = {
|
||||
site: 'raiplay.it',
|
||||
days: 2,
|
||||
url: function ({ date, channel }) {
|
||||
return `https://www.raiplay.it/palinsesto/app/${channel.site_id}/${date.format(
|
||||
'DD-MM-YYYY'
|
||||
)}.json`
|
||||
},
|
||||
parser: function ({ content, date }) {
|
||||
const programs = []
|
||||
const data = JSON.parse(content)
|
||||
if (!data.events) return programs
|
||||
|
||||
data.events.forEach(item => {
|
||||
if (!item.name || !item.hour || !item.duration_in_minutes) return
|
||||
const start = parseStart(item, date)
|
||||
const duration = parseInt(item.duration_in_minutes)
|
||||
const stop = start.add(duration, 'm')
|
||||
|
||||
programs.push({
|
||||
title: item.name || item.program.name,
|
||||
description: item.description,
|
||||
season: parseSeason(item),
|
||||
episode: parseEpisode(item),
|
||||
sub_title: item['episode_title'] || null,
|
||||
url: parseURL(item),
|
||||
start,
|
||||
stop,
|
||||
image: parseImage(item)
|
||||
})
|
||||
})
|
||||
|
||||
return programs
|
||||
}
|
||||
}
|
||||
|
||||
function parseStart(item, date) {
|
||||
return dayjs.tz(`${date.format('YYYY-MM-DD')} ${item.hour}`, 'YYYY-MM-DD HH:mm', 'Europe/Rome')
|
||||
}
|
||||
|
||||
function parseImage(item) {
|
||||
let cover = null
|
||||
if (item.image) {
|
||||
cover = `https://www.raiplay.it${item.image}`
|
||||
}
|
||||
return cover
|
||||
}
|
||||
|
||||
function parseURL(item) {
|
||||
let url = null
|
||||
if (item.weblink) {
|
||||
url = `https://www.raiplay.it${item.weblink}`
|
||||
}
|
||||
if (item.event_weblink) {
|
||||
url = `https://www.raiplay.it${item.event_weblink}`
|
||||
}
|
||||
return url
|
||||
}
|
||||
|
||||
function parseSeason(item) {
|
||||
if (!item.season) return null
|
||||
if (String(item.season).length > 2) return null
|
||||
return item.season
|
||||
}
|
||||
|
||||
function parseEpisode(item) {
|
||||
if (!item.episode) return null
|
||||
if (String(item.episode).length > 3) return null
|
||||
return item.episode
|
||||
}
|
||||
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(customParseFormat)
|
||||
dayjs.extend(timezone)
|
||||
|
||||
module.exports = {
|
||||
site: 'raiplay.it',
|
||||
days: 2,
|
||||
url: function ({ date, channel }) {
|
||||
return `https://www.raiplay.it/palinsesto/app/${channel.site_id}/${date.format(
|
||||
'DD-MM-YYYY'
|
||||
)}.json`
|
||||
},
|
||||
parser: function ({ content, date }) {
|
||||
const programs = []
|
||||
const data = JSON.parse(content)
|
||||
if (!data.events) return programs
|
||||
|
||||
data.events.forEach(item => {
|
||||
if (!item.name || !item.hour || !item.duration_in_minutes) return
|
||||
const start = parseStart(item, date)
|
||||
const duration = parseInt(item.duration_in_minutes)
|
||||
const stop = start.add(duration, 'm')
|
||||
|
||||
programs.push({
|
||||
title: item.name || item.program.name,
|
||||
description: item.description,
|
||||
season: parseSeason(item),
|
||||
episode: parseEpisode(item),
|
||||
sub_title: item['episode_title'] || null,
|
||||
url: parseURL(item),
|
||||
start,
|
||||
stop,
|
||||
image: parseImage(item)
|
||||
})
|
||||
})
|
||||
|
||||
return programs
|
||||
}
|
||||
}
|
||||
|
||||
function parseStart(item, date) {
|
||||
return dayjs.tz(`${date.format('YYYY-MM-DD')} ${item.hour}`, 'YYYY-MM-DD HH:mm', 'Europe/Rome')
|
||||
}
|
||||
|
||||
function parseImage(item) {
|
||||
let cover = null
|
||||
if (item.image) {
|
||||
cover = `https://www.raiplay.it${item.image}`
|
||||
}
|
||||
return cover
|
||||
}
|
||||
|
||||
function parseURL(item) {
|
||||
let url = null
|
||||
if (item.weblink) {
|
||||
url = `https://www.raiplay.it${item.weblink}`
|
||||
}
|
||||
if (item.event_weblink) {
|
||||
url = `https://www.raiplay.it${item.event_weblink}`
|
||||
}
|
||||
return url
|
||||
}
|
||||
|
||||
function parseSeason(item) {
|
||||
if (!item.season) return null
|
||||
if (String(item.season).length > 2) return null
|
||||
return item.season
|
||||
}
|
||||
|
||||
function parseEpisode(item) {
|
||||
if (!item.episode) return null
|
||||
if (String(item.episode).length > 3) return null
|
||||
return item.episode
|
||||
}
|
||||
|
||||
@@ -1,50 +1,50 @@
|
||||
const { parser, url } = require('./raiplay.it.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-05-03', 'YYYY-MM-DD')
|
||||
const channel = {
|
||||
site_id: 'rai-2',
|
||||
xmltv_id: 'Rai2.it'
|
||||
}
|
||||
|
||||
it('can generate valid url', () => {
|
||||
expect(url({ channel, date })).toBe('https://www.raiplay.it/palinsesto/app/rai-2/03-05-2022.json')
|
||||
})
|
||||
|
||||
it('can parse response', () => {
|
||||
const content = fs.readFileSync(path.resolve(__dirname, '__data__/content.json'))
|
||||
const result = parser({ content, date }).map(p => {
|
||||
p.start = p.start.toJSON()
|
||||
p.stop = p.stop.toJSON()
|
||||
|
||||
return p
|
||||
})
|
||||
|
||||
expect(result).toMatchObject([
|
||||
{
|
||||
start: '2022-05-03T17:40:00.000Z',
|
||||
stop: '2022-05-03T18:30:00.000Z',
|
||||
title: 'The Good Doctor S3E5 - La prima volta',
|
||||
description:
|
||||
"Shaun affronta il suo primo intervento. Il caso si rivela complicato e, nonostante Shaun abbia un'idea geniale, sarà Andrews a portare a termine l'operazione.",
|
||||
season: '3',
|
||||
episode: '5',
|
||||
sub_title: 'La prima volta',
|
||||
image: 'https://www.raiplay.it/dl/img/2020/03/09/1583748471860_dddddd.jpg',
|
||||
url: 'https://www.raiplay.it/dirette/rai2/The-Good-Doctor-S3E5---La-prima-volta-2f81030d-803b-456a-9ea5-40233234fd9d.html'
|
||||
}
|
||||
])
|
||||
})
|
||||
|
||||
it('can handle empty guide', () => {
|
||||
const result = parser({
|
||||
content: fs.readFileSync(path.resolve(__dirname, '__data__/no_content.json'))
|
||||
})
|
||||
expect(result).toMatchObject([])
|
||||
})
|
||||
const { parser, url } = require('./raiplay.it.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-05-03', 'YYYY-MM-DD')
|
||||
const channel = {
|
||||
site_id: 'rai-2',
|
||||
xmltv_id: 'Rai2.it'
|
||||
}
|
||||
|
||||
it('can generate valid url', () => {
|
||||
expect(url({ channel, date })).toBe('https://www.raiplay.it/palinsesto/app/rai-2/03-05-2022.json')
|
||||
})
|
||||
|
||||
it('can parse response', () => {
|
||||
const content = fs.readFileSync(path.resolve(__dirname, '__data__/content.json'))
|
||||
const result = parser({ content, date }).map(p => {
|
||||
p.start = p.start.toJSON()
|
||||
p.stop = p.stop.toJSON()
|
||||
|
||||
return p
|
||||
})
|
||||
|
||||
expect(result).toMatchObject([
|
||||
{
|
||||
start: '2022-05-03T17:40:00.000Z',
|
||||
stop: '2022-05-03T18:30:00.000Z',
|
||||
title: 'The Good Doctor S3E5 - La prima volta',
|
||||
description:
|
||||
"Shaun affronta il suo primo intervento. Il caso si rivela complicato e, nonostante Shaun abbia un'idea geniale, sarà Andrews a portare a termine l'operazione.",
|
||||
season: '3',
|
||||
episode: '5',
|
||||
sub_title: 'La prima volta',
|
||||
image: 'https://www.raiplay.it/dl/img/2020/03/09/1583748471860_dddddd.jpg',
|
||||
url: 'https://www.raiplay.it/dirette/rai2/The-Good-Doctor-S3E5---La-prima-volta-2f81030d-803b-456a-9ea5-40233234fd9d.html'
|
||||
}
|
||||
])
|
||||
})
|
||||
|
||||
it('can handle empty guide', () => {
|
||||
const result = parser({
|
||||
content: fs.readFileSync(path.resolve(__dirname, '__data__/no_content.json'))
|
||||
})
|
||||
expect(result).toMatchObject([])
|
||||
})
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
# raiplay.it
|
||||
|
||||
https://www.raiplay.it/guidatv
|
||||
|
||||
### Download the guide
|
||||
|
||||
```sh
|
||||
npm run grab --- --site=raiplay.it
|
||||
```
|
||||
|
||||
### Test
|
||||
|
||||
```sh
|
||||
npm test --- raiplay.it
|
||||
```
|
||||
# raiplay.it
|
||||
|
||||
https://www.raiplay.it/guidatv
|
||||
|
||||
### Download the guide
|
||||
|
||||
```sh
|
||||
npm run grab --- --site=raiplay.it
|
||||
```
|
||||
|
||||
### Test
|
||||
|
||||
```sh
|
||||
npm test --- raiplay.it
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user