Merge pull request #844 from iptv-org/add-tv.yettel.hu

Add guide from tv.yettel.hu
This commit is contained in:
Aleksandr Statciuk 2022-06-17 18:45:40 +03:00 committed by GitHub
commit be99bf7fba
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 247 additions and 0 deletions

17
.github/workflows/tv.yettel.hu.yml vendored Normal file
View file

@ -0,0 +1,17 @@
name: tv.yettel.hu
on:
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
workflow_run:
workflows: [_trigger]
types:
- completed
jobs:
load:
uses: ./.github/workflows/_load.yml
with:
site: ${{github.workflow}}
secrets:
APP_ID: ${{ secrets.APP_ID }}
APP_PRIVATE_KEY: ${{ secrets.APP_PRIVATE_KEY }}

View file

@ -0,0 +1,68 @@
const axios = require('axios')
const dayjs = require('dayjs')
module.exports = {
site: 'tv.yettel.hu',
url: function ({ channel, date }) {
return `https://dev.mytvback.com/api/19/default/hu-HU/schedules?livechannelpids=${
channel.site_id
}&includeImages=cover%3A100%3A144&filterAvailability=false&startTime=${date.unix()}&endTime=${date
.add(1, 'd')
.unix()}`
},
parser: function ({ content }) {
let programs = []
const items = parseItems(content)
items.forEach(item => {
programs.push({
title: item.Title,
description: item.ShortDescription,
icon: parseIcon(item),
start: parseStart(item),
stop: parseStop(item)
})
})
return programs
},
async channels() {
const data = await axios
.get(`https://dev.mytvback.com/api/19/default/hu-HU/content/CHA_LIVE_MYTV2_HU/children`)
.then(r => r.data)
.catch(console.log)
const channels = []
for (let item of data.Content.List) {
channels.push({
lang: 'hu',
site_id: item.Pid,
name: item.CallLetter
})
}
return channels
}
}
function parseIcon(item) {
if (Array.isArray(item.Images.Cover) && item.Images.Cover.length) {
return item.Images.Cover[0].Url
}
return null
}
function parseStart(item) {
return dayjs.unix(item.Start)
}
function parseStop(item) {
return dayjs.unix(item.End)
}
function parseItems(content) {
const data = JSON.parse(content)
if (!data || !Array.isArray(data.Content)) return []
return data.Content
}

View file

@ -0,0 +1,83 @@
// npm run channels:parse -- --config=./sites/tv.yettel.hu/tv.yettel.hu.config.js --output=./sites/tv.yettel.hu/tv.yettel.hu_hu.channels.xml
// npx epg-grabber --config=sites/tv.yettel.hu/tv.yettel.hu.config.js --channels=sites/tv.yettel.hu/tv.yettel.hu_hu.channels.xml --output=guide.xml --days=2
const { parser, url } = require('./tv.yettel.hu.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('2022-06-17', 'YYYY-MM-DD').startOf('d')
const channel = {
site_id: 'LCH1',
xmltv_id: 'M1.hu'
}
it('can generate valid url', () => {
expect(url({ channel, date })).toBe(
'https://dev.mytvback.com/api/19/default/hu-HU/schedules?livechannelpids=LCH1&includeImages=cover%3A100%3A144&filterAvailability=false&startTime=1655424000&endTime=1655510400'
)
})
it('can parse response', () => {
const content = `{
"Content": [
{
"AgeRatingPid": "",
"catchup_days": "0",
"AvailableUntil": 1655445600,
"Description": "",
"End": 1655445600,
"LiveChannelPid": "LCH1",
"ch_id": "1",
"LiveProgramPid": "LEP3906574",
"pr_id": "3906574",
"se_id": "13986",
"LiveSeriesPid": "LSE13986",
"Pid": "LSC17202373",
"id": "17202373",
"Rating": 0,
"RatingTotalVotes": 0,
"ShortDescription": "A Ma reggel az MTVA saját gyártású, minden hétköznap jelentkező reggeli politikai és közéleti témákkal foglalkozó műsora.",
"Start": 1655443980,
"Title": "Ma reggel",
"Year": 2022,
"GenrePids": [
"GEN184"
],
"ge_id": "184",
"IsCatchup": "1",
"ChannelIsCatchup": "0",
"Images": {
"Cover": [
{
"Url": "https://static.mytvback.com/userfiles/c/0/c01d48a36b913a7afb0dcb5edba33849_thum_100x144.jpg"
}
]
}
}]}`
const result = parser({ content }).map(p => {
p.start = p.start.toJSON()
p.stop = p.stop.toJSON()
return p
})
expect(result).toMatchObject([
{
start: '2022-06-17T05:33:00.000Z',
stop: '2022-06-17T06:00:00.000Z',
title: 'Ma reggel',
description:
'A Ma reggel az MTVA saját gyártású, minden hétköznap jelentkező reggeli politikai és közéleti témákkal foglalkozó műsora.',
icon: 'https://static.mytvback.com/userfiles/c/0/c01d48a36b913a7afb0dcb5edba33849_thum_100x144.jpg'
}
])
})
it('can handle empty guide', () => {
const result = parser({
content: `{"Content":[],"HttpStatusCode":200,"StatusCode":0,"StatusMessage":"OK","Severity":1}`
})
expect(result).toMatchObject([])
})

View file

@ -0,0 +1,79 @@
<?xml version="1.0" encoding="UTF-8"?>
<site site="tv.yettel.hu">
<channels>
<channel lang="hu" xmltv_id="AMCHungary.hu" site_id="LCH16">AMC</channel>
<channel lang="hu" xmltv_id="AnimalPlanetHungary.hu" site_id="LCH136">Animal Planet</channel>
<channel lang="hu" xmltv_id="Arena4.hu" site_id="LCH179">Arena4</channel>
<channel lang="hu" xmltv_id="ATV.hu" site_id="LCH182">ATV</channel>
<channel lang="hu" xmltv_id="BBCEarthHungary.hu" site_id="LCH63">BBC Earth</channel>
<channel lang="hu" xmltv_id="BBCWorldNewsEurope.uk" site_id="LCH53">BBC World News</channel>
<channel lang="hu" xmltv_id="BoomerangHungary.hu" site_id="LCH119">Boomerang</channel>
<channel lang="hu" xmltv_id="CartoonNetworkHungary.hu" site_id="LCH118">Cartoon Network</channel>
<channel lang="hu" xmltv_id="CNNInternationalEurope.us" site_id="LCH150">CNN</channel>
<channel lang="hu" xmltv_id="ComedyCentralFamilyHungary.hu" site_id="LCH161">Comedy Central Family</channel>
<channel lang="hu" xmltv_id="ComedyCentralHungary.hu" site_id="LCH104">Comedy Central</channel>
<channel lang="hu" xmltv_id="CoolTV.hu" site_id="LCH45">Cool</channel>
<channel lang="hu" xmltv_id="DaVinciHungary.hu" site_id="LCH188">Da Vinci</channel>
<channel lang="hu" xmltv_id="DiscoveryChannelHungary.hu" site_id="LCH125">Discovery Channel</channel>
<channel lang="hu" xmltv_id="DiscoveryScienceHungary.hu" site_id="LCH130">Discovery Science</channel>
<channel lang="hu" xmltv_id="DisneyChannelHungary.hu" site_id="LCH115">Disney Channel</channel>
<channel lang="hu" xmltv_id="DTXHungary.hu" site_id="LCH148">DTX</channel>
<channel lang="hu" xmltv_id="DunaTV.hu" site_id="LCH29">Duna</channel>
<channel lang="hu" xmltv_id="DunaWorld.hu" site_id="LCH40">Duna World</channel>
<channel lang="hu" xmltv_id="EuronewsHungarian.fr" site_id="LCH166">Euronews</channel>
<channel lang="hu" xmltv_id="FEM3.hu" site_id="LCH85">FEM3</channel>
<channel lang="hu" xmltv_id="FilmCafeHungary.hu" site_id="LCH42">FilmCafe</channel>
<channel lang="hu" xmltv_id="FilmPlus.hu" site_id="LCH44">Film+</channel>
<channel lang="hu" xmltv_id="FoodNetworkHungary.hu" site_id="LCH37">Food Network</channel>
<channel lang="hu" xmltv_id="HirTV.hu" site_id="LCH185">Hír TV</channel>
<channel lang="hu" xmltv_id="InvestigationDiscoveryHungary.hu" site_id="LCH110">Investigation Discovery</channel>
<channel lang="hu" xmltv_id="IzauraTV.hu" site_id="LCH88">Izaura TV</channel>
<channel lang="hu" xmltv_id="JimJamHungary.hu" site_id="LCH81">JimJam</channel>
<channel lang="hu" xmltv_id="JockyTV.hu" site_id="LCH173">Jocky TV</channel>
<channel lang="hu" xmltv_id="LifeTV.hu" site_id="LCH108">LifeTv</channel>
<channel lang="hu" xmltv_id="M1.hu" site_id="LCH1">M1</channel>
<channel lang="hu" xmltv_id="M2.hu" site_id="LCH2">M2</channel>
<channel lang="hu" xmltv_id="M4Sport.hu" site_id="LCH57">M4 Sport</channel>
<channel lang="hu" xmltv_id="M5.hu" site_id="LCH60">M5</channel>
<channel lang="hu" xmltv_id="MinimaxHungary.hu" site_id="LCH15">Minimax</channel>
<channel lang="hu" xmltv_id="MoziPlus.hu" site_id="LCH26">Mozi+</channel>
<channel lang="hu" xmltv_id="Moziverzum.hu" site_id="LCH174">Moziverzum</channel>
<channel lang="hu" xmltv_id="MTV00s.uk" site_id="LCH155">MTV 00s</channel>
<channel lang="hu" xmltv_id="MTV80s.uk" site_id="LCH165">MTV 80s</channel>
<channel lang="hu" xmltv_id="MTV90s.uk" site_id="LCH154">MTV90s</channel>
<channel lang="hu" xmltv_id="MTVHitsEurope.uk" site_id="LCH152">MTV Hits</channel>
<channel lang="hu" xmltv_id="MTVHungary.hu" site_id="LCH163">MTV Hungary</channel>
<channel lang="hu" xmltv_id="MuzsikaTV.hu" site_id="LCH10">Muzsika TV</channel>
<channel lang="hu" xmltv_id="NationalGeographicHungaryCzechia.us" site_id="LCH133">National Geographic</channel>
<channel lang="hu" xmltv_id="NationalGeographicWildHungary.hu" site_id="LCH137">National Geographic Wild</channel>
<channel lang="hu" xmltv_id="NickelodeonHungary.hu" site_id="LCH13">Nickelodeon</channel>
<channel lang="hu" xmltv_id="NickJrHungary.hu" site_id="LCH25">Nick Junior</channel>
<channel lang="hu" xmltv_id="OzoneTV.hu" site_id="LCH105">OzoneTv</channel>
<channel lang="hu" xmltv_id="ParamountNetworkHungary.hu" site_id="LCH98">Paramount Channel</channel>
<channel lang="hu" xmltv_id="Prime.hu" site_id="LCH27">Prime</channel>
<channel lang="hu" xmltv_id="RTLGold.hu" site_id="LCH17">RTL Gold</channel>
<channel lang="hu" xmltv_id="RTLII.hu" site_id="LCH46">RTL II</channel>
<channel lang="hu" xmltv_id="RTLKlub.hu" site_id="LCH43">RTL KLUB</channel>
<channel lang="hu" xmltv_id="RTLPlus.hu" site_id="LCH9">RTL+</channel>
<channel lang="hu" xmltv_id="SorozatPlus.hu" site_id="LCH18">Sorozat+</channel>
<channel lang="hu" xmltv_id="Spektrum.hu" site_id="LCH39">Spektrum</channel>
<channel lang="hu" xmltv_id="SpektrumHome.hu" site_id="LCH79">Spektrum Home</channel>
<channel lang="hu" xmltv_id="SpilerTV1.hu" site_id="LCH71">Spíler1 TV</channel>
<channel lang="hu" xmltv_id="SpilerTV2.hu" site_id="LCH170">Spíler2 TV</channel>
<channel lang="hu" xmltv_id="Sport1Hungary.hu" site_id="LCH41">Sport1</channel>
<channel lang="hu" xmltv_id="Sport2Hungary.hu" site_id="LCH84">Sport2</channel>
<channel lang="hu" xmltv_id="SuperTV2.hu" site_id="LCH12">Super TV2</channel>
<channel lang="hu" xmltv_id="TeenNickHungary.hu" site_id="LCH177">TeenNick</channel>
<channel lang="hu" xmltv_id="TLCHungary.hu" site_id="LCH145">TLC</channel>
<channel lang="hu" xmltv_id="TravelChannelHungary.hu" site_id="LCH35">Travel Channel</channel>
<channel lang="hu" xmltv_id="TV2.hu" site_id="LCH11">TV2</channel>
<channel lang="hu" xmltv_id="TV2Comedy.hu" site_id="LCH91">TV2 Comedy</channel>
<channel lang="hu" xmltv_id="TV2Kids.hu" site_id="LCH95">TV2 Kids</channel>
<channel lang="hu" xmltv_id="TV2Sef.hu" site_id="LCH92">TV2 Séf</channel>
<channel lang="hu" xmltv_id="TVPaprika.hu" site_id="LCH38">TV Paprika</channel>
<channel lang="hu" xmltv_id="ViasatExploreHungary.hu" site_id="LCH141">Viasat Explore</channel>
<channel lang="hu" xmltv_id="ViasatHistoryHungary.hu" site_id="LCH128">Viasat History</channel>
<channel lang="hu" xmltv_id="ViasatNatureHungary.hu" site_id="LCH138">Viasat Nature</channel>
<channel lang="hu" xmltv_id="Zenebutik.hu" site_id="LCH86">Zenebutik</channel>
</channels>
</site>