mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-09 08:30:06 -04:00
Add nzxmltv.com.
Signed-off-by: Toha <tohenk@yahoo.com>
This commit is contained in:
parent
7a42c3775b
commit
25a4fe8877
4 changed files with 241 additions and 0 deletions
93
sites/nzxmltv.com/__data__/content.xml
Normal file
93
sites/nzxmltv.com/__data__/content.xml
Normal file
|
@ -0,0 +1,93 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE tv SYSTEM "nzxmltv.dtd">
|
||||
<tv date="2023-11-22 04:00:15" source-info-url="https://freeviewnz.tv/tvguide/whats-on/" source-info-name="NZXMLTV (Freeview)" source-data-url="https://freeviewnz.tv/localservices/opg/schedule" generator-info-url="https://nzxmltv.com/xmltv/" generator-info-name="NZXMLTV Freeview 3.0">
|
||||
<channel id="1">
|
||||
<display-name lang="en_NZ">TVNZ 1</display-name>
|
||||
<url>https://helptvnz.zendesk.com/hc/en-us/requests/new</url>
|
||||
<icon src="https://freeviewnz.tv/nonumbracoimages/ChannelsThumb/TVNZ1100x100.png" />
|
||||
<!-- Start NZXMLTV Custom Tags -->
|
||||
<desc lang="en_NZ">As New Zealand's leading producer of local entertainment programmes, news and current affairs, and national television events. TVNZ 1 is uniquely positioned to deliver the content New Zealanders value and celebrate. Selected programmes on TVNZ 1 are broadcast in HD via UHF. To access HD programming, you will need UHF coverage and use a UHF aerial.</desc>
|
||||
<lcn>1</lcn>
|
||||
<!-- End NZXMLTV Custom Tags -->
|
||||
</channel>
|
||||
<programme start="20231121103000 +0000" stop="20231121112500 +0000" channel="1">
|
||||
<title>Sunday</title>
|
||||
<sub-title>Sunday</sub-title>
|
||||
<desc>On Sunday, an unmissable show with stories about divorce, weight loss, and the incomprehensible devastation of Gaza.</desc>
|
||||
<date></date>
|
||||
<category>Documentary</category>
|
||||
<keyword>series</keyword>
|
||||
<icon src="https://www.thetvdb.com/banners/posters/5dbebff2986f2.jpg" />
|
||||
<country>New Zealand</country>
|
||||
<episode-num system="dd_seriesid">1035483</episode-num>
|
||||
<episode-num system="dd_progid">10681949</episode-num>
|
||||
<episode-num system="freeviewnz.tv">episode/28725468-c065-4355-86ce-093f5d09dd14</episode-num>
|
||||
<episode-num system="freeviewnz.tv">show/a9fa9bab-883b-4b22-b890-b61ee34338a1</episode-num>
|
||||
<episode-num system="original-air-date">2023-11-19 19:30:00</episode-num>
|
||||
<episode-num system="themoviedb.com">tv/11796</episode-num>
|
||||
<episode-num system="thetvdb.com">series/358626</episode-num>
|
||||
<episode-num system="xmltv_ns">2022.36.0</episode-num>
|
||||
<episode-num system="tvnz.co.nz">show/ibms+show:320</episode-num>
|
||||
<video>
|
||||
<present>yes</present>
|
||||
<colour>yes</colour>
|
||||
<aspect>16:9</aspect>
|
||||
<quality>768x576</quality>
|
||||
</video>
|
||||
<audio>
|
||||
<present>yes</present>
|
||||
<stereo>stereo</stereo>
|
||||
</audio>
|
||||
<previously-shown />
|
||||
<subtitles type="teletext">
|
||||
<language lang="en_NZ">English (NZ)</language>
|
||||
</subtitles>
|
||||
<star-rating system="themoviedb.org">
|
||||
<value>0/10</value>
|
||||
</star-rating>
|
||||
<series-desc>Join Miriama Kamo and the team as they delve into the subjects that matter to you.
|
||||
</series-desc>
|
||||
</programme>
|
||||
<programme start="20231121112500 +0000" stop="20231121121000 +0000" channel="1">
|
||||
<title>Rich House, Poor House</title>
|
||||
<sub-title>Wildes/ Pickston</sub-title>
|
||||
<desc>Kim and Dave have risked everything by converting a field in Northumberland into an organic farm, but rarely have time off and money is tight. They swap with millionaire businesswoman Ampika.</desc>
|
||||
<date>2017</date>
|
||||
<category>Documentary</category>
|
||||
<category>Factual</category>
|
||||
<keyword>series</keyword>
|
||||
<icon src="https://image.tmdb.org/t/p/original/s7ej2zgGVidwrnyBblHnVRCqS0R.jpg" />
|
||||
<country>United Kingdom</country>
|
||||
<episode-num system="dd_seriesid">1034142</episode-num>
|
||||
<episode-num system="dd_progid">10649234</episode-num>
|
||||
<episode-num system="freeviewnz.tv">episode/1abb3ded-e6c4-4457-9fef-f66015837aa5</episode-num>
|
||||
<episode-num system="freeviewnz.tv">show/dd2c2dee-2c78-47ad-9a98-6e1e91a33de4</episode-num>
|
||||
<episode-num system="original-air-date">2023-06-22 20:30:00</episode-num>
|
||||
<episode-num system="themoviedb.com">tv/70899</episode-num>
|
||||
<episode-num system="thetvdb.com">series/325959</episode-num>
|
||||
<episode-num system="xmltv_ns">7.5.0</episode-num>
|
||||
<episode-num system="tvnz.co.nz">show/ibms+show:3839</episode-num>
|
||||
<video>
|
||||
<present>yes</present>
|
||||
<colour>yes</colour>
|
||||
<aspect>16:9</aspect>
|
||||
<quality>HDTV</quality>
|
||||
</video>
|
||||
<audio>
|
||||
<present>yes</present>
|
||||
<stereo>stereo</stereo>
|
||||
</audio>
|
||||
<previously-shown />
|
||||
<subtitles type="teletext">
|
||||
<language lang="en_NZ">English (NZ)</language>
|
||||
</subtitles>
|
||||
<rating system="New Zealand">
|
||||
<value>G</value>
|
||||
</rating>
|
||||
<star-rating system="themoviedb.org">
|
||||
<value>7/10</value>
|
||||
</star-rating>
|
||||
<series-desc>Two families find out how the other half lives, swapping homes, social status and budgets with people from opposite ends of the financial spectrum and class divide.</series-desc>
|
||||
<audio-description lang="en_NZ" />
|
||||
</programme>
|
||||
</tv>
|
40
sites/nzxmltv.com/nzxmltv.com.channels.xml
Normal file
40
sites/nzxmltv.com/nzxmltv.com.channels.xml
Normal file
|
@ -0,0 +1,40 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<channels>
|
||||
<!--
|
||||
<channel site="nzxmltv.com" lang="en" xmltv_id="" site_id="28">ChineseTV8</channel>
|
||||
<channel site="nzxmltv.com" lang="en" xmltv_id="" site_id="29">Panda Channel 29</channel>
|
||||
<channel site="nzxmltv.com" lang="en" xmltv_id="" site_id="31">Parliament TV</channel>
|
||||
<channel site="nzxmltv.com" lang="en" xmltv_id="" site_id="33">C33</channel>
|
||||
<channel site="nzxmltv.com" lang="en" xmltv_id="" site_id="37">PandaTV</channel>
|
||||
<channel site="nzxmltv.com" lang="en" xmltv_id="" site_id="39">Southern TV</channel>
|
||||
<channel site="nzxmltv.com" lang="en" xmltv_id="" site_id="48">Television Hawke's Bay</channel>
|
||||
<channel site="nzxmltv.com" lang="en" xmltv_id="" site_id="50">RadioNZ National</channel>
|
||||
<channel site="nzxmltv.com" lang="en" xmltv_id="" site_id="51">RadioNZ Concert</channel>
|
||||
<channel site="nzxmltv.com" lang="en" xmltv_id="" site_id="70">GeorgeFM</channel>
|
||||
<channel site="nzxmltv.com" lang="en" xmltv_id="" site_id="71">BaseFM</channel>
|
||||
-->
|
||||
<channel site="nzxmltv.com" lang="en" xmltv_id="AlJazeeraEnglish.qa" site_id="20">Al Jazeera</channel>
|
||||
<channel site="nzxmltv.com" lang="en" xmltv_id="Bravo.nz" site_id="4">Bravo</channel>
|
||||
<channel site="nzxmltv.com" lang="en" xmltv_id="BravoPlus1.nz" site_id="9">Bravo Plus 1</channel>
|
||||
<channel site="nzxmltv.com" lang="en" xmltv_id="Channel200.nz" site_id="200">CH200</channel>
|
||||
<channel site="nzxmltv.com" lang="en" xmltv_id="eden.nz" site_id="8">eden</channel>
|
||||
<channel site="nzxmltv.com" lang="en" xmltv_id="edenPlus1.nz" site_id="18">eden+1</channel>
|
||||
<channel site="nzxmltv.com" lang="en" xmltv_id="Firstlight.nz" site_id="26">Firstlight</channel>
|
||||
<channel site="nzxmltv.com" lang="en" xmltv_id="HGTV.nz" site_id="19">HGTV</channel>
|
||||
<channel site="nzxmltv.com" lang="en" xmltv_id="HopeChannel.nz" site_id="27">Hope Channel</channel>
|
||||
<channel site="nzxmltv.com" lang="en" xmltv_id="PRIME.nz" site_id="15">PRIME</channel>
|
||||
<channel site="nzxmltv.com" lang="en" xmltv_id="PRIMEPlus1.nz" site_id="21">PRIME +1</channel>
|
||||
<channel site="nzxmltv.com" lang="en" xmltv_id="Rush.nz" site_id="14">Rush</channel>
|
||||
<channel site="nzxmltv.com" lang="en" xmltv_id="ShineTV.nz" site_id="25">Shine TV</channel>
|
||||
<channel site="nzxmltv.com" lang="en" xmltv_id="TeReo.nz" site_id="10">Te Reo</channel>
|
||||
<channel site="nzxmltv.com" lang="en" xmltv_id="Three.nz" site_id="3">Three</channel>
|
||||
<channel site="nzxmltv.com" lang="en" xmltv_id="ThreePlus1.nz" site_id="13">ThreePlus1</channel>
|
||||
<channel site="nzxmltv.com" lang="en" xmltv_id="TVNZ1.nz" site_id="1">TVNZ 1</channel>
|
||||
<channel site="nzxmltv.com" lang="en" xmltv_id="TVNZ1Plus1.nz" site_id="11">TVNZ 1 +1</channel>
|
||||
<channel site="nzxmltv.com" lang="en" xmltv_id="TVNZ2.nz" site_id="2">TVNZ 2</channel>
|
||||
<channel site="nzxmltv.com" lang="en" xmltv_id="TVNZ2Plus1.nz" site_id="7">TVNZ 2 +1</channel>
|
||||
<channel site="nzxmltv.com" lang="en" xmltv_id="TVNZDUKE.nz" site_id="6">TVNZ DUKE</channel>
|
||||
<channel site="nzxmltv.com" lang="en" xmltv_id="TVNZDUKEPlus1.nz" site_id="12">TVNZ DUKE +1</channel>
|
||||
<channel site="nzxmltv.com" lang="en" xmltv_id="WairarapaTV.nz" site_id="41">Wairarapa TV</channel>
|
||||
<channel site="nzxmltv.com" lang="en" xmltv_id="WhakaataMaori.nz" site_id="5">Whakaata Māori</channel>
|
||||
</channels>
|
65
sites/nzxmltv.com/nzxmltv.com.config.js
Normal file
65
sites/nzxmltv.com/nzxmltv.com.config.js
Normal file
|
@ -0,0 +1,65 @@
|
|||
const parser = require('epg-parser')
|
||||
|
||||
module.exports = {
|
||||
site: 'nzxmltv.com',
|
||||
days: 2,
|
||||
request: {
|
||||
cache: {
|
||||
ttl: 3600000 // 1 hour
|
||||
},
|
||||
maxContentLength: 10485760 // 10 MB
|
||||
},
|
||||
url: 'https://nzxmltv.com/xmltv/guide.xml',
|
||||
parser({ content, channel, date }) {
|
||||
const programs = []
|
||||
parseItems(content, channel, date).forEach(item => {
|
||||
const program = {
|
||||
title: item.title?.[0]?.value,
|
||||
description: item.desc?.[0]?.value,
|
||||
icon: item.icon?.[0],
|
||||
start: item.start,
|
||||
stop: item.stop
|
||||
}
|
||||
if (item.episodeNum) {
|
||||
item.episodeNum.forEach(ep => {
|
||||
if (ep.system === 'xmltv_ns') {
|
||||
const [season, episode, _] = ep.value.split('.')
|
||||
program.season = parseInt(season) + 1
|
||||
program.episode = parseInt(episode) + 1
|
||||
return true
|
||||
}
|
||||
})
|
||||
}
|
||||
programs.push(program)
|
||||
})
|
||||
|
||||
return programs
|
||||
},
|
||||
async channels() {
|
||||
const axios = require('axios')
|
||||
const cheerio = require('cheerio')
|
||||
const xml = await axios
|
||||
.get('https://nzxmltv.com/xmltv/guide.xml')
|
||||
.then(r => r.data)
|
||||
.catch(console.error)
|
||||
|
||||
const channels = []
|
||||
const $ = cheerio.load(xml)
|
||||
$('tv channel').each((i, el) => {
|
||||
const disp = $(el).find('display-name')
|
||||
channels.push({
|
||||
lang: disp.attr('lang').substr(0, 2),
|
||||
site_id: $(el).attr('id'),
|
||||
name: disp.text().trim()
|
||||
})
|
||||
})
|
||||
|
||||
return channels
|
||||
}
|
||||
}
|
||||
|
||||
function parseItems(content, channel, date) {
|
||||
const { programs } = parser.parse(content)
|
||||
|
||||
return programs.filter(p => p.channel === channel.site_id && date.isSame(p.start, 'day'))
|
||||
}
|
43
sites/nzxmltv.com/nzxmltv.com.test.js
Normal file
43
sites/nzxmltv.com/nzxmltv.com.test.js
Normal file
|
@ -0,0 +1,43 @@
|
|||
// npm run channels:parse -- --config=./sites/nzxmltv.com/nzxmltv.com.config.js --output=./sites/nzxmltv.com/nzxmltv.com.channels.xml
|
||||
// npm run grab -- --site=nzxmltv.com
|
||||
|
||||
const { parser, url } = require('./nzxmltv.com.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('2023-11-21').startOf('d')
|
||||
const channel = {
|
||||
site_id: '1',
|
||||
xmltv_id: 'TVNZ1.nz'
|
||||
}
|
||||
|
||||
it('can generate valid url', () => {
|
||||
expect(url).toBe('https://nzxmltv.com/xmltv/guide.xml')
|
||||
})
|
||||
|
||||
it('can parse response', () => {
|
||||
const content = fs.readFileSync(path.resolve(__dirname, '__data__/content.xml'))
|
||||
const results = parser({ content, channel, date })
|
||||
|
||||
expect(results[0]).toMatchObject({
|
||||
start: '2023-11-21T10:30:00.000Z',
|
||||
stop: '2023-11-21T11:25:00.000Z',
|
||||
title: 'Sunday',
|
||||
description:
|
||||
'On Sunday, an unmissable show with stories about divorce, weight loss, and the incomprehensible devastation of Gaza.',
|
||||
season: 2023,
|
||||
episode: 37,
|
||||
icon: 'https://www.thetvdb.com/banners/posters/5dbebff2986f2.jpg'
|
||||
})
|
||||
})
|
||||
|
||||
it('can handle empty guide', () => {
|
||||
const result = parser({ content: '', channel, date })
|
||||
expect(result).toMatchObject([])
|
||||
})
|
Loading…
Add table
Add a link
Reference in a new issue