Initial Commit

This commit is contained in:
2023-09-10 21:48:48 +02:00
commit 227cca7d31
791 changed files with 165200 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<site site="novacyprus.com">
<channels>
<channel lang="el" xmltv_id="AnimalPlanetAfrica.za" site_id="645">Animal Planet Africa</channel>
<channel lang="el" xmltv_id="BoomerangCEE.us" site_id="610">Boomerang Central &amp; Eastern Europe</channel>
<channel lang="el" xmltv_id="DisneyChannelMENA.uk" site_id="593">Disney Channel Middle East</channel>
<channel lang="el" xmltv_id="EuronewsGreek.fr" site_id="672">EuroNews Ellinika</channel>
<channel lang="el" xmltv_id="Eurosport1.fr" site_id="627">Eurosport 1</channel>
<channel lang="el" xmltv_id="Eurosport2.fr" site_id="638">Eurosport 2</channel>
<channel lang="el" xmltv_id="FoxGreece.gr" site_id="609">Fox Greece</channel>
<channel lang="el" xmltv_id="FoxLifeGreece.gr" site_id="570">Fox Life Greece</channel>
<channel lang="el" xmltv_id="HellenicParliamentTV.gr" site_id="521">Vouli TV</channel>
<channel lang="el" xmltv_id="InsightTV.nl" site_id="81">Insight HD</channel>
<channel lang="el" xmltv_id="MADGreekz.gr" site_id="582">Mad Greekz</channel>
<channel lang="el" xmltv_id="MadTV.gr" site_id="227">Mad TV</channel>
<channel lang="el" xmltv_id="MTVLive.uk" site_id="673">MTV Live</channel>
<channel lang="el" xmltv_id="MyZenTV.fr" site_id="221">MyZen TV</channel>
<channel lang="el" xmltv_id="NationalGeographicGreece.gr" site_id="617">National Geographic Ellada</channel>
<channel lang="el" xmltv_id="NickelodeonGreece.gr" site_id="544">Nickelodeon Greece</channel>
<channel lang="el" xmltv_id="Novacinema1.gr" site_id="614">Nova Cinema 1</channel>
<channel lang="el" xmltv_id="Novacinema2.gr" site_id="653">Nova Cinema 2</channel>
<channel lang="el" xmltv_id="Novacinema3.gr" site_id="652">Nova Cinema 3</channel>
<channel lang="el" xmltv_id="Novacinema4.gr" site_id="667">Nova Cinema 4</channel>
<channel lang="el" xmltv_id="Novalife.gr" site_id="53">Nova Life</channel>
<channel lang="el" xmltv_id="Novasports2.gr" site_id="639">Nova Sports 2</channel>
<channel lang="el" xmltv_id="Novasports3.gr" site_id="669">Nova Sports 3</channel>
<channel lang="el" xmltv_id="Novasports4.gr" site_id="142">Nova Sports 4</channel>
<channel lang="el" xmltv_id="Novasports5.gr" site_id="17">Nova Sports 5</channel>
<channel lang="el" xmltv_id="Number1TV.tr" site_id="649">Number 1 TV</channel>
<channel lang="el" xmltv_id="OneChannel.gr" site_id="584">One Channel</channel>
<channel lang="el" xmltv_id="SmileTV.gr" site_id="576">Smile TV</channel>
<channel lang="el" xmltv_id="ViasatHistory.se" site_id="580">Viasat History HD</channel>
</channels>
</site>

View File

@@ -0,0 +1,67 @@
process.env['NODE_TLS_REJECT_UNAUTHORIZED'] = 0
const axios = require('axios')
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: 'novacyprus.com',
days: 2,
url({ channel, date }) {
return `https://www.novacyprus.com/api/v1/tvprogram/from/${date.format('YYYYMMDD')}/to/${date
.add(1, 'd')
.format('YYYYMMDD')}`
},
parser({ content, channel }) {
let programs = []
const items = parseItems(content, channel)
items.forEach(item => {
const start = parseStart(item)
const stop = start.add(item.slotDuration, 'm')
programs.push({
title: item.title,
description: item.description,
icon: parseIcon(item),
start,
stop
})
})
return programs
},
async channels({ country, lang }) {
const channels = await axios
.get(`https://www.novacyprus.com/api/v1/guide/dailychannels`)
.then(r => r.data)
.catch(console.log)
return channels.map(item => {
return {
lang: 'el',
site_id: item.ChannelId,
name: item.nameEl
}
})
}
}
function parseStart(item) {
return dayjs.tz(item.datetime, 'YYYY-MM-DD HH:mm:ss', 'Asia/Nicosia')
}
function parseIcon(item) {
return item.mediaItems.length ? item.mediaItems[0].CdnUrl : null
}
function parseItems(content, channel) {
const data = JSON.parse(content)
if (!data || !Array.isArray(data.nodes)) return []
return data.nodes.filter(i => i.ChannelId === channel.site_id)
}

View File

@@ -0,0 +1,49 @@
// node ./scripts/channels.js --config=./sites/novacyprus.com/novacyprus.com.config.js --output=./sites/novacyprus.com/novacyprus.com.channels.xml
// npx epg-grabber --config=sites/novacyprus.com/novacyprus.com.config.js --channels=sites/novacyprus.com/novacyprus.com.channels.xml --output=guide.xml --days=2
const { parser, url } = require('./novacyprus.com.config.js')
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('2021-11-17', 'YYYY-MM-DD').startOf('d')
const channel = {
site_id: '614',
xmltv_id: 'NovaCinema1.gr'
}
it('can generate valid url', () => {
expect(url({ date })).toBe(
'https://www.novacyprus.com/api/v1/tvprogram/from/20211117/to/20211118'
)
})
it('can parse response', () => {
const content = `{"nodes":[{"datetime":"2021-11-17 06:20:00","day":"Wednesday","numDay":17,"numMonth":11,"month":"November","channelName":"Cyprus Novacinema1HD","channelLog":"https:\/\/ssl2.novago.gr\/EPG\/jsp\/images\/universal\/film\/logo\/20200210\/000100\/XTV100000762\/d6a2f5e0-dbc0-49c7-9843-e3161ca5ae5d.png","cid":"42","ChannelId":"614","startingTime":"06:20","endTime":"08:10","title":"Δεσμοί Αίματος","description":"Θρίλερ Μυστηρίου","duration":"109","slotDuration":"110","bref":"COMMOBLOOX","mediaItems":[{"MediaListTypeId":"6","CdnUrl":"http:\/\/cache-forthnet.secure.footprint.net\/linear\/3\/0\/305608_COMMOBLOOX_GUIDE_STILL.jpg"},{"MediaListTypeId":"7","CdnUrl":"http:\/\/cache-forthnet.secure.footprint.net\/linear\/3\/0\/305608_COMMOBLOOX_POSTER_CROSS.jpg"},{"MediaListTypeId":"8","CdnUrl":"http:\/\/cache-forthnet.secure.footprint.net\/linear\/3\/0\/305608_COMMOBLOOX_ICON_CYP.jpg"},{"MediaListTypeId":"9","CdnUrl":"http:\/\/cache-forthnet.secure.footprint.net\/linear\/3\/0\/305608_COMMOBLOOX_POSTER_CYP.jpg"},{"MediaListTypeId":"10","CdnUrl":"http:\/\/cache-forthnet.secure.footprint.net\/linear\/3\/0\/305608_COMMOBLOOX_BACKGROUND_CYP.jpg"}]},{"datetime":"2021-11-17 06:00:00","day":"Wednesday","numDay":17,"numMonth":11,"month":"November","channelName":"Cyprus Novacinema2HD","channelLog":"https:\/\/ssl2.novago.gr\/EPG\/jsp\/images\/universal\/film\/logo\/20200210\/000100\/XTV100000763\/24e05354-d6ad-4949-bcb3-a81d1c1d2cba.png","cid":"62","ChannelId":"653","startingTime":"06:00","endTime":"07:40","title":"Ανυπόφοροι Γείτονες","description":"Κωμωδία","duration":"93","slotDuration":"100","bref":"NEIGHBORSX","mediaItems":[{"MediaListTypeId":"7","CdnUrl":"http:\/\/cache-forthnet.secure.footprint.net\/linear\/3\/1\/312582_NEIGHBORSX_POSTER_CROSS.jpg"},{"MediaListTypeId":"8","CdnUrl":"http:\/\/cache-forthnet.secure.footprint.net\/linear\/3\/1\/312582_NEIGHBORSX_ICON_CYP.jpg"},{"MediaListTypeId":"9","CdnUrl":"http:\/\/cache-forthnet.secure.footprint.net\/linear\/3\/1\/312582_NEIGHBORSX_POSTER_CYP.jpg"},{"MediaListTypeId":"10","CdnUrl":"http:\/\/cache-forthnet.secure.footprint.net\/linear\/3\/1\/312582_NEIGHBORSX_BACKGROUND_CYP.jpg"}]}]}`
const result = parser({ content, channel }).map(p => {
p.start = p.start.toJSON()
p.stop = p.stop.toJSON()
return p
})
expect(result).toMatchObject([
{
start: '2021-11-17T04:20:00.000Z',
stop: '2021-11-17T06:10:00.000Z',
title: 'Δεσμοί Αίματος',
description: 'Θρίλερ Μυστηρίου',
icon: 'http://cache-forthnet.secure.footprint.net/linear/3/0/305608_COMMOBLOOX_GUIDE_STILL.jpg'
}
])
})
it('can handle empty guide', () => {
const result = parser({
date,
channel,
content: `{"nodes":[],"total":0,"pages":0}`
})
expect(result).toMatchObject([])
})