Merge pull request #2559 from fraudiay79/cosmotetv.gr

Add Cosmotetv.gr and delete cosmote.gr
This commit is contained in:
Aleksandr Statciuk 2024-12-31 07:30:09 +03:00 committed by GitHub
commit 7e7efaa487
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 294 additions and 11307 deletions

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,100 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<channels>
<channel site="cosmote.gr" lang="el" xmltv_id="" site_id="a-epsilon">α.Epsilon</channel>
<channel site="cosmote.gr" lang="el" xmltv_id="" site_id="action-24">Action 24</channel>
<channel site="cosmote.gr" lang="el" xmltv_id="" site_id="alpha-hd">ALPHA HD</channel>
<channel site="cosmote.gr" lang="el" xmltv_id="" site_id="ant1-hd">ANT1 HD</channel>
<channel site="cosmote.gr" lang="el" xmltv_id="" site_id="bbc-news">BBC News</channel>
<channel site="cosmote.gr" lang="el" xmltv_id="" site_id="bergina-tv">Βεργίνα TV</channel>
<channel site="cosmote.gr" lang="el" xmltv_id="" site_id="cosmote-cinema-1hd">COSMOTE CINEMA 1HD</channel>
<channel site="cosmote.gr" lang="el" xmltv_id="" site_id="cosmote-cinema-2-hd">COSMOTE CINEMA 2 HD</channel>
<channel site="cosmote.gr" lang="el" xmltv_id="" site_id="cosmote-cinema-3">COSMOTE CINEMA 3</channel>
<channel site="cosmote.gr" lang="el" xmltv_id="" site_id="cosmote-cinema-kids-hd">COSMOTE Cinema Kids HD</channel>
<channel site="cosmote.gr" lang="el" xmltv_id="" site_id="cosmote-history-hd">COSMOTE HISTORY HD</channel>
<channel site="cosmote.gr" lang="el" xmltv_id="" site_id="cosmote-series-hd">COSMOTE SERIES HD</channel>
<channel site="cosmote.gr" lang="el" xmltv_id="" site_id="cosmote-series-marathon">COSMOTE SERIES MARATHON</channel>
<channel site="cosmote.gr" lang="el" xmltv_id="" site_id="cosmote-sport-1hd">COSMOTE SPORT 1HD</channel>
<channel site="cosmote.gr" lang="el" xmltv_id="" site_id="cosmote-sport-2hd">COSMOTE SPORT 2HD</channel>
<channel site="cosmote.gr" lang="el" xmltv_id="" site_id="cosmote-sport-3hd">COSMOTE SPORT 3HD</channel>
<channel site="cosmote.gr" lang="el" xmltv_id="" site_id="cosmote-sport-4hd">COSMOTE SPORT 4HD</channel>
<channel site="cosmote.gr" lang="el" xmltv_id="" site_id="cosmote-sport-4k">COSMOTE Sport 4K</channel>
<channel site="cosmote.gr" lang="el" xmltv_id="" site_id="cosmote-sport-5hd">COSMOTE SPORT 5HD</channel>
<channel site="cosmote.gr" lang="el" xmltv_id="" site_id="cosmote-sport-6hd">COSMOTE SPORT 6HD</channel>
<channel site="cosmote.gr" lang="el" xmltv_id="" site_id="cosmote-sport-7hd">COSMOTE SPORT 7HD</channel>
<channel site="cosmote.gr" lang="el" xmltv_id="" site_id="cosmote-sport-8hd">COSMOTE SPORT 8HD</channel>
<channel site="cosmote.gr" lang="el" xmltv_id="" site_id="cosmote-sport-9hd">COSMOTE SPORT 9HD</channel>
<channel site="cosmote.gr" lang="el" xmltv_id="" site_id="cosmote-sport-highlights-hd">COSMOTE SPORT HIGHLIGHTS HD</channel>
<channel site="cosmote.gr" lang="el" xmltv_id="" site_id="disney-junior">Disney Junior</channel>
<channel site="cosmote.gr" lang="el" xmltv_id="" site_id="ducktv">ducktv</channel>
<channel site="cosmote.gr" lang="el" xmltv_id="" site_id="dw">DW</channel>
<channel site="cosmote.gr" lang="el" xmltv_id="" site_id="ena-channel">ENA Channel</channel>
<channel site="cosmote.gr" lang="el" xmltv_id="" site_id="ert-news">ΕΡΤ NEWS</channel>
<channel site="cosmote.gr" lang="el" xmltv_id="" site_id="ert1-hd">ΕΡΤ1 HD</channel>
<channel site="cosmote.gr" lang="el" xmltv_id="" site_id="ert2-hd">ΕΡΤ2 HD</channel>
<channel site="cosmote.gr" lang="el" xmltv_id="" site_id="ert3-hd">ΕΡΤ3 HD</channel>
<channel site="cosmote.gr" lang="el" xmltv_id="" site_id="euronews-greek">Euronews Greek</channel>
<channel site="cosmote.gr" lang="el" xmltv_id="" site_id="ftv-hd">FTV HD</channel>
<channel site="cosmote.gr" lang="el" xmltv_id="" site_id="fx">FX</channel>
<channel site="cosmote.gr" lang="el" xmltv_id="" site_id="fx-life">FX Life</channel>
<channel site="cosmote.gr" lang="el" xmltv_id="" site_id="kontra-channel">Kontra</channel>
<channel site="cosmote.gr" lang="el" xmltv_id="" site_id="krete-nea-teleorase">Κρήτη Νέα Τηλεόραση</channel>
<channel site="cosmote.gr" lang="el" xmltv_id="" site_id="mad-viral-hd">MAD Viral HD</channel>
<channel site="cosmote.gr" lang="el" xmltv_id="" site_id="makedonia-tv-hd">Μακεδονία TV HD</channel>
<channel site="cosmote.gr" lang="el" xmltv_id="" site_id="mezzo-live-hd">MEZZO LIVE HD</channel>
<channel site="cosmote.gr" lang="el" xmltv_id="" site_id="mtv-00s">MTV 00s</channel>
<channel site="cosmote.gr" lang="el" xmltv_id="" site_id="mtv-live">MTV Live</channel>
<channel site="cosmote.gr" lang="el" xmltv_id="" site_id="museum-tv">Museum TV</channel>
<channel site="cosmote.gr" lang="el" xmltv_id="" site_id="myzen-tv">MyZen TV</channel>
<channel site="cosmote.gr" lang="el" xmltv_id="" site_id="naftemporiki">Naftemporiki</channel>
<channel site="cosmote.gr" lang="el" xmltv_id="" site_id="national-geographic-hd">National Geographic HD</channel>
<channel site="cosmote.gr" lang="el" xmltv_id="" site_id="nickelodeon-hd">Nickelodeon HD</channel>
<channel site="cosmote.gr" lang="el" xmltv_id="" site_id="one-channel-hd">ONE Channel HD</channel>
<channel site="cosmote.gr" lang="el" xmltv_id="" site_id="open-beyond-hd">OPEN BEYOND HD</channel>
<channel site="cosmote.gr" lang="el" xmltv_id="" site_id="panik-tv">Panik TV</channel>
<channel site="cosmote.gr" lang="el" xmltv_id="" site_id="penthouse-gold">Penthouse Gold</channel>
<channel site="cosmote.gr" lang="el" xmltv_id="" site_id="skai-hd">ΣΚΑΪ HD</channel>
<channel site="cosmote.gr" lang="el" xmltv_id="" site_id="sky-news">Sky News</channel>
<channel site="cosmote.gr" lang="el" xmltv_id="" site_id="star-hd">STAR HD</channel>
<channel site="cosmote.gr" lang="el" xmltv_id="" site_id="stingray-cmusic">Stingray CMusic</channel>
<channel site="cosmote.gr" lang="el" xmltv_id="" site_id="stingray-iconcerts">Stingray iConcerts</channel>
<channel site="cosmote.gr" lang="el" xmltv_id="" site_id="tcm-hd">TCM HD</channel>
<channel site="cosmote.gr" lang="el" xmltv_id="" site_id="viasat-explore-hd">Viasat Explore HD</channel>
<channel site="cosmote.gr" lang="el" xmltv_id="" site_id="viasat-history-hd">Viasat History HD</channel>
<channel site="cosmote.gr" lang="el" xmltv_id="" site_id="viasat-nature-hd">Viasat Nature HD</channel>
<channel site="cosmote.gr" lang="el" xmltv_id="" site_id="vixen">VIXEN</channel>
<channel site="cosmote.gr" lang="el" xmltv_id="4E.gr" site_id="4e">4Ε</channel>
<channel site="cosmote.gr" lang="el" xmltv_id="AigaioTV.gr" site_id="aigaio-tv">Αιγαίο TV</channel>
<channel site="cosmote.gr" lang="el" xmltv_id="Alarabiya.ae" site_id="al-arabiya">Al Arabiya</channel>
<channel site="cosmote.gr" lang="el" xmltv_id="AlJazeeraEnglish.qa" site_id="al-jazeera">Al Jazeera</channel>
<channel site="cosmote.gr" lang="el" xmltv_id="BabyTV.uk" site_id="baby-tv">Baby TV</channel>
<channel site="cosmote.gr" lang="el" xmltv_id="BBCEarth.gr" site_id="bbc-earth-hd">BBC Earth HD</channel>
<channel site="cosmote.gr" lang="el" xmltv_id="BloombergTVEurope.uk" site_id="bloomberg">Bloomberg</channel>
<channel site="cosmote.gr" lang="el" xmltv_id="BlueHustler.nl" site_id="blue-hustler">Blue Hustler</channel>
<channel site="cosmote.gr" lang="el" xmltv_id="CBSRealityEMEA.uk" site_id="cbs-reality">CBS Reality</channel>
<channel site="cosmote.gr" lang="el" xmltv_id="CNBCEurope.uk" site_id="cnbc">CNBC</channel>
<channel site="cosmote.gr" lang="el" xmltv_id="CNNInternationalEurope.us" site_id="cnn">CNN</channel>
<channel site="cosmote.gr" lang="el" xmltv_id="CrimePlusInvestigation.uk" site_id="crime-and-investigation">Crime and Investigation</channel>
<channel site="cosmote.gr" lang="el" xmltv_id="DisneyChannelMENA.uk" site_id="disney-channel">Disney Channel</channel>
<channel site="cosmote.gr" lang="el" xmltv_id="EDGEsport.uk" site_id="edgesport-hd">EDGEsport HD</channel>
<channel site="cosmote.gr" lang="el" xmltv_id="EEurope.nl" site_id="e-hd">E! HD</channel>
<channel site="cosmote.gr" lang="el" xmltv_id="ENAChannel.gr" site_id="tv100">TV100</channel>
<channel site="cosmote.gr" lang="el" xmltv_id="ERTWorld.gr" site_id="ert-world">ERT WORLD</channel>
<channel site="cosmote.gr" lang="el" xmltv_id="EuronewsEnglish.fr" site_id="euronews-english">Euronews English</channel>
<channel site="cosmote.gr" lang="el" xmltv_id="France24English.fr" site_id="france-24-en">France 24 En</channel>
<channel site="cosmote.gr" lang="el" xmltv_id="France24French.fr" site_id="france-24-fr">France 24 Fr</channel>
<channel site="cosmote.gr" lang="el" xmltv_id="GINXEsportsTV.uk" site_id="ginx-esports">GINX eSports</channel>
<channel site="cosmote.gr" lang="el" xmltv_id="HellenicParliamentTV.gr" site_id="boule">ΒΟΥΛΗ</channel>
<channel site="cosmote.gr" lang="el" xmltv_id="HustlerHD.nl" site_id="hustler-tv-hd">Hustler TV HD</channel>
<channel site="cosmote.gr" lang="el" xmltv_id="KritiTV.gr" site_id="krete-tv">ΚΡΗΤΗ TV</channel>
<channel site="cosmote.gr" lang="el" xmltv_id="LuxeTV.lu" site_id="luxe-tv-hd">Luxe TV HD</channel>
<channel site="cosmote.gr" lang="el" xmltv_id="MadTV.gr" site_id="mad">MAD</channel>
<channel site="cosmote.gr" lang="el" xmltv_id="MEGATV.gr" site_id="mega-hd">MEGA HD</channel>
<channel site="cosmote.gr" lang="el" xmltv_id="Motorvision.de" site_id="motorvision-channel-hd">Motorvision+</channel>
<channel site="cosmote.gr" lang="el" xmltv_id="MTVGlobal.uk" site_id="mtv-europe">MTV Europe</channel>
<channel site="cosmote.gr" lang="el" xmltv_id="NationalGeographicWild.gr" site_id="nat-geo-wild-hd">Nat Geo Wild HD</channel>
<channel site="cosmote.gr" lang="el" xmltv_id="NauticalChannel.it" site_id="nautical-channel-hd">Nautical Channel HD</channel>
<channel site="cosmote.gr" lang="el" xmltv_id="SirinaTV.gr" site_id="sirina-tv">Sirina TV</channel>
<channel site="cosmote.gr" lang="el" xmltv_id="SmileTV.gr" site_id="smile-tv">Smile TV</channel>
<channel site="cosmote.gr" lang="el" xmltv_id="StarKentrikisElladas.gr" site_id="star-kentrikes-elladas">Star Κεντρικής Ελλάδας</channel>
<channel site="cosmote.gr" lang="el" xmltv_id="VillageCinemas.gr" site_id="village-cinema-hd">Village Cinema HD</channel>
</channels>

View file

@ -1,103 +0,0 @@
const axios = require('axios')
const cheerio = require('cheerio')
const { DateTime } = require('luxon')
module.exports = {
site: 'cosmote.gr',
days: 2,
url: function ({ date, channel }) {
return `https://www.cosmotetv.gr/portal/residential/program/epg/programchannel?p_p_id=channelprogram_WAR_OTETVportlet&p_p_lifecycle=0&_channelprogram_WAR_OTETVportlet_platform=IPTV&_channelprogram_WAR_OTETVportlet_date=${date.format(
'DD-MM-YYYY'
)}&_channelprogram_WAR_OTETVportlet_articleTitleUrl=${channel.site_id}`
},
parser: function ({ date, content }) {
let programs = []
const items = parseItems(content)
items.forEach((item, i) => {
const prev = programs[programs.length - 1]
const $item = cheerio.load(item)
let start = parseStart($item, date)
if (i === 0 && start.hour > 12 && start.hour < 21) {
date = date.subtract(1, 'd')
start = start.minus({ days: 1 })
}
if (prev && start < prev.start) {
start = start.plus({ days: 1 })
date = date.add(1, 'd')
}
let stop = parseStop($item, date)
if (stop < start) {
stop = stop.plus({ days: 1 })
date = date.add(1, 'd')
}
programs.push({
title: parseTitle($item),
category: parseCategory($item),
start,
stop
})
})
return programs
},
async channels() {
const data = await axios
.get(`https://www.cosmotetv.gr/portal/residential/program`)
.then(r => r.data)
.catch(console.log)
let channels = []
const $ = cheerio.load(data)
$('#program-channels-selectbox > option').each((i, el) => {
const value = $(el).attr('value')
if (!value || value == '-1') return
const url = new URL(decodeURIComponent(value))
const site_id = url.searchParams.get('_channelprogram_WAR_OTETVportlet_articleTitleUrl')
channels.push({
lang: 'el',
site_id,
name: $(el).text().trim()
})
})
return channels
}
}
function parseTitle($item) {
return $item('.channel_program-table--program > a').text()
}
function parseCategory($item) {
const typeString = $item('.channel_program-table--program_type')
.children()
.remove()
.end()
.text()
.trim()
const [, category] = typeString.match(/\| (.*)/) || [null, null]
return category
}
function parseStart($item, date) {
const timeString = $item('span.start-time').text()
const dateString = `${date.format('YYYY-MM-DD')} ${timeString}`
return DateTime.fromFormat(dateString, 'yyyy-MM-dd HH:mm', { zone: 'Europe/Athens' }).toUTC()
}
function parseStop($item, date) {
const timeString = $item('span.end-time').text()
const dateString = `${date.format('YYYY-MM-DD')} ${timeString}`
return DateTime.fromFormat(dateString, 'yyyy-MM-dd HH:mm', { zone: 'Europe/Athens' }).toUTC()
}
function parseItems(content) {
const $ = cheerio.load(content)
return $('#_channelprogram_WAR_OTETVportlet_programs > tr.d-sm-table-row').toArray()
}

View file

@ -1,77 +0,0 @@
const { parser, url } = require('./cosmote.gr.config.js')
const fs = require('fs')
const path = require('path')
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)
const date = dayjs.utc('2023-06-08', 'YYYY-MM-DD').startOf('d')
const channel = {
site_id: '4e',
xmltv_id: '4E.gr'
}
it('can generate valid url', () => {
expect(url({ channel, date })).toBe(
'https://www.cosmotetv.gr/portal/residential/program/epg/programchannel?p_p_id=channelprogram_WAR_OTETVportlet&p_p_lifecycle=0&_channelprogram_WAR_OTETVportlet_platform=IPTV&_channelprogram_WAR_OTETVportlet_date=08-06-2023&_channelprogram_WAR_OTETVportlet_articleTitleUrl=4e'
)
})
it('can parse response', () => {
const content = fs.readFileSync(path.resolve(__dirname, '__data__/content1.html'))
const results = parser({ content, date }).map(p => {
p.start = p.start.toJSON()
p.stop = p.stop.toJSON()
return p
})
expect(results[0]).toMatchObject({
start: '2023-06-07T20:30:00.000Z',
stop: '2023-06-07T21:45:00.000Z',
title: 'Τηλεφημερίδα',
category: 'Εκπομπή - Μαγκαζίνο'
})
expect(results[30]).toMatchObject({
start: '2023-06-08T19:45:00.000Z',
stop: '2023-06-08T20:30:00.000Z',
title: 'Μικρό Απόδειπνο',
category: 'Special'
})
})
it('can parse response when the guide starting before midnight', () => {
const content = fs.readFileSync(path.resolve(__dirname, '__data__/content2.html'))
const results = parser({ content, date }).map(p => {
p.start = p.start.toJSON()
p.stop = p.stop.toJSON()
return p
})
expect(results[0]).toMatchObject({
start: '2023-06-07T21:30:00.000Z',
stop: '2023-06-07T22:30:00.000Z',
title: 'Καλύτερα Αργά',
category: 'Ψυχαγωγική Εκπομπή'
})
expect(results[22]).toMatchObject({
start: '2023-06-08T19:00:00.000Z',
stop: '2023-06-08T21:30:00.000Z',
title: 'Πίσω Από Τις Γραμμές',
category: 'Εκπομπή - Μαγκαζίνο'
})
})
it('can handle empty guide', () => {
const result = parser({
date,
content: '<!DOCTYPE html><html><head></head><body></body></html>'
})
expect(result).toMatchObject([])
})

View file

@ -1,21 +0,0 @@
# cosmote.gr
https://www.cosmote.gr/ _[Geo-blocked]_
### Download the guide
```sh
npm run grab --- --site=cosmote.gr
```
### Update channel list
```sh
npm run channels:parse --- --config=./sites/cosmote.gr/cosmote.gr.config.js --output=./sites/cosmote.gr/cosmote.gr.channels.xml
```
### Test
```sh
npm test --- cosmote.gr
```

View file

@ -0,0 +1,111 @@
<?xml version="1.0" encoding="UTF-8"?>
<channels>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="action24">Action 24</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="alarabiya">Al Arabiya</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="aljazeera">Al Jazeera</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="alphahd">ALPHA</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="ant1hd">ANT1</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="asharq">Asharq News</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="atticatv">ATTICA TV</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="babytv">Baby TV</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="bbcearthhd">BBC Earth HD</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="bbcworldnews">BBC News</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="bloomberg">Bloomberg</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="channel4e">4Ε</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="cinema1hd">COSMOTE Cinema 1 HD</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="cinema2hd">COSMOTE Cinema 2 HD</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="cinema3">COSMOTE Cinema 3</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="cinema4hd">COSMOTE Series HD</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="cnbc">CNBC</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="cnn">CNN</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="crimeinvestig">Crime and Investigation</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="deutschewelle">Deutsche Welle</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="disneychannel">Disney Channel</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="disneyjunior">Disney Junior</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="ducktv">ducktv</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="ehd">E! HD</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="enachannel">ENA Channel</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="ert1">ΕΡΤ1 HD</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="ert2">ΕΡΤ2 HD</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="ert3">ΕΡΤ3 HD</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="ertnews">ΕΡΤ NEWS</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="ertworld">ERT WORLD</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="euronewseng">Euronews English</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="euronewsgreek">Euronews Greek</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="fashiontv">FTV HD</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="foxhd">FX</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="foxlifehd">FX Life</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="france24en">France 24 En</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="ginxesports">GINX eSports</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="highlightshd">COSMOTE Sport Highlights HD</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="historyhd">COSMOTE History HD</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="kontrahd">Kontra</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="kritineatv">Κρήτη Νέα Τηλεόραση</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="krititv">Κρήτη TV</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="luxetvhd">Luxe TV HD</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="madhd">MAD HD</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="madhitshd">MAD Viral HD</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="makedoniatv">Μακεδονία TV HD</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="marathonhd">COSMOTE Series Marathon</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="megahd">MEGA HD</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="mezzo">MEZZO LIVE HD</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="motorvisionhd">Motorvision+</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="mtveurope">MTV Europe</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="mtvhits">MTV Hits</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="mtvlivehd">MTV Live</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="museumtv">Museum TV</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="myzentvhd">MyZen TV</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="naftemporhd">Naftemporiki</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="natgeowildhd">Nat Geo Wild HD</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="nationalgeo">National Geographic HD</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="nauticalhd">Nautical Channel HD</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="nickelodeonhd">Nickelodeon HD</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="nova1">Novasports1HD</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="nova2">Novasports2HD</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="nova3">Novasports3HD</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="nova4">Novasports4HD</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="nova5">Novasports5HD</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="nova6">Novasports6HD</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="novaextra1">Novasportsextra1HD</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="novaextra2">Novasportsextra2HD</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="novaextra3">Novasportsextra3HD</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="novaextra4">Novasportsextra4HD</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="novanews">Novasports News HD</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="novaplg">Novasports Premier League HD</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="novaprime">Novasports Prime HD</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="novastart">Novasports Start HD</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="onechannelhd">ONE Channel HD</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="openbeyondhd">OPEN BEYOND</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="panikhd">Panik TV</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="popup03">CosmoteCinemaChristmasHD</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="promohd">Promo HD</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="skaihd">ΣΚΑΪ</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="skynews">Sky News</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="smiletv">Smile TV</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="sport1hd">COSMOTE Sport 1 HD</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="sport2hd">COSMOTE Sport 2 HD</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="sport3hd">COSMOTE Sport 3 HD</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="sport4hd">COSMOTE Sport 4 HD</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="sport4k1">COSMOTE Sport 4K</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="sport5hd">COSMOTE Sport 5 HD</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="sport6hd">COSMOTE Sport 6 HD</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="sport7hd">COSMOTE Sport 7 HD</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="sport8hd">COSMOTE Sport 8 HD</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="sport9hd">COSMOTE Sport 9 HD</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="starhd">STAR</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="starkentriki">Star Κεντρικής Ελλάδας</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="stingraycmusic">Stingray CMusic</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="stingrayiconc">Stingray iConcerts</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="tcmhd">TCM</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="team01hd">ΑΕΚ SL Pass</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="team02hd">ΟΛΥΜΠΙΑΚΟΣ SL Pass</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="team03hd">ΠΑΝΑΘΗΝΑΪΚΟΣ SL Pass</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="tv100">TV100</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="verginatv">Βεργίνα TV</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="vh1">MTV 00s</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="viasatexplore">Viasat Explore HD</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="viasathistory">Viasat History HD</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="viasatnature">Viasat Nature HD</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="villagehd">Village Cinema HD</channel>
<channel site="cosmotetv.gr" lang="el" xmltv_id="" site_id="vouli">ΒΟΥΛΗ HD</channel>
</channels>

View file

@ -0,0 +1,81 @@
const dayjs = require('dayjs')
const utc = require('dayjs/plugin/utc')
const customParseFormat = require('dayjs/plugin/customParseFormat')
const timezone = require('dayjs/plugin/timezone')
dayjs.extend(utc)
dayjs.extend(customParseFormat)
dayjs.extend(timezone)
module.exports = {
site: 'cosmotetv.gr',
days: 5,
request: {
cache: {
ttl: 60 * 60 * 1000 // 1 hour
},
method: 'GET',
headers: {
'referer': 'https://www.cosmotetv.gr/',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36',
'Accept': '*/*',
'Accept-Language': 'en-US,en;q=0.9',
'Accept-Encoding': 'gzip, deflate, br, zstd',
'Origin': 'https://www.cosmotetv.gr',
'Sec-Ch-Ua': '"Not.A/Brand";v="24", "Chromium";v="131", "Google Chrome";v="131"',
'Sec-Ch-Ua-Mobile': '?0',
'Sec-Ch-Ua-Platform': '"Windows"',
'Sec-Fetch-Dest': 'empty',
'Sec-Fetch-Mode': 'cors',
'Sec-Fetch-Site': 'cross-site'
}
},
url: function ({date, channel}) {
const startOfDay = dayjs(date).startOf('day').utc().unix()
const endOfDay = dayjs(date).endOf('day').utc().unix()
return `https://mwapi-prod.cosmotetvott.gr/api/v3.4/epg/listings/el?from=${startOfDay}&to=${endOfDay}&callSigns=${channel.site_id}&endingIncludedInRange=false`
},
parser: function ({ date, content }) {
let programs = []
const data = JSON.parse(content)
data.channels.forEach(channel => {
channel.items.forEach(item => {
const start = dayjs(item.startTime).utc().toISOString()
const stop = dayjs(item.endTime).utc().toISOString()
programs.push({
title: item.title,
description: item.description || 'No description available',
category: item.qoe.genre,
image: item.thumbnails.standard,
start,
stop
})
})
})
return programs
},
async channels() {
const axios = require('axios')
try {
const response = await axios.get('https://mwapi-prod.cosmotetvott.gr/api/v3.4/epg/channels/all/el', {
headers: this.request.headers
})
const data = response.data
if (data && data.channels) {
return data.channels.map(item => ({
lang: 'el',
site_id: item.callSign,
name: item.title,
//logo: item.logos.square
}))
} else {
console.error('Unexpected response structure:', data)
return []
}
} catch (error) {
console.error('Error fetching channel data:', error)
return []
}
}
}

View file

@ -0,0 +1,81 @@
const { parser, url, channels } = require('./cosmotetv.gr.config.js')
const dayjs = require('dayjs')
const utc = require('dayjs/plugin/utc')
const customParseFormat = require('dayjs/plugin/customParseFormat')
const timezone = require('dayjs/plugin/timezone')
const axios = require('axios')
dayjs.extend(utc)
dayjs.extend(customParseFormat)
dayjs.extend(timezone)
jest.mock('axios')
const date = dayjs.utc('2024-12-26', 'YYYY-MM-DD').startOf('d')
const channel = { site_id: 'vouli', xmltv_id: 'HellenicParliamentTV.gr' }
const mockChannelData = {
"channels": [
{
"guid": "XTV100000954",
"title": "ΒΟΥΛΗ HD",
"callSign": "vouli",
"logos": {
"square": "https://tr.static.cdn.cosmotetvott.gr/ote-prod/channel_logos/vouli1-normal.png",
"wide": "https://tr.static.cdn.cosmotetvott.gr/ote-prod/channel_logos/vouli1-wide.png"
}
}
]
}
const mockEpgData = {
"channels": [
{
"items": [
{
"startTime": "2024-12-26T23:00:00+00:00",
"endTime": "2024-12-27T00:00:00+00:00",
"title": "Τι Λέει ο Νόμος",
"description": "νημερωτική εκπομπή. Συζήτηση με τους εισηγητές των κομμάτων για το νομοθετικό έργο.",
"qoe": {
"genre": "Special"
},
"thumbnails": {
"standard": "https://gr-ermou-prod-cache05.static.cdn.cosmotetvott.gr/ote-prod/70/280/040029714812000800_1734415727199.jpg"
}
}
]
}
]
}
it('can generate valid url', () => {
const startOfDay = dayjs(date).startOf('day').utc().unix()
const endOfDay = dayjs(date).endOf('day').utc().unix()
expect(url({ date, channel })).toBe(`https://mwapi-prod.cosmotetvott.gr/api/v3.4/epg/listings/el?from=${startOfDay}&to=${endOfDay}&callSigns=${channel.site_id}&endingIncludedInRange=false`)
})
it('can parse response', () => {
const content = JSON.stringify(mockEpgData)
const result = parser({ date, content }).map(p => {
p.start = dayjs(p.start).toISOString()
p.stop = dayjs(p.stop).toISOString()
return p
})
expect(result).toMatchObject([
{
title: "Τι Λέει ο Νόμος",
description: "νημερωτική εκπομπή. Συζήτηση με τους εισηγητές των κομμάτων για το νομοθετικό έργο.",
category: "Special",
image: "https://gr-ermou-prod-cache05.static.cdn.cosmotetvott.gr/ote-prod/70/280/040029714812000800_1734415727199.jpg",
start: "2024-12-26T23:00:00.000Z",
stop: "2024-12-27T00:00:00.000Z"
}
])
})
it('can handle empty guide', () => {
const result = parser({ date, channel, content: '{"date":"2024-12-26","categories":[],"channels":[]}' });
expect(result).toMatchObject([])
})

View file

@ -0,0 +1,21 @@
# cosmotetv.gr
https://www.cosmotetv.gr/portal/program
### Download the guide
```sh
npm run grab --- --site=cosmotetv.gr
```
### Update channel list
```sh
npm run channels:parse --- --config=./sites/cosmotetv.gr/cosmotetv.gr.config.js --output=./sites/cosmotetv.gr/cosmotetv.gr.channels.xml
```
### Test
```sh
npm test --- cosmotetv.gr
```