mirror of
https://github.com/iptv-org/epg
synced 2026-03-21 19:30:52 -04:00
fix syn.is naming parse (possible next.js workaround)
This commit is contained in:
@@ -1,16 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<channels>
|
||||
<channel site="syn.is" site_id="beint" lang="is" xmltv_id=""></channel>
|
||||
<channel site="syn.is" site_id="bio" lang="is" xmltv_id=""></channel>
|
||||
<channel site="syn.is" site_id="syn" lang="is" xmltv_id=""></channel>
|
||||
<channel site="syn.is" site_id="synsport" lang="is" xmltv_id="Stod2Sport.is@SD">Stöð 2 Sport</channel>
|
||||
<channel site="syn.is" site_id="synsport2" lang="is" xmltv_id="Stod2Sport2.is@SD">Stöð 2 Sport 2</channel>
|
||||
<channel site="syn.is" site_id="synsport3" lang="is" xmltv_id="Stod2Sport3.is@SD">Stöð 2 Sport 3</channel>
|
||||
<channel site="syn.is" site_id="synsport4" lang="is" xmltv_id="Stod2Sport4.is@SD">Stöð 2 Sport 4</channel>
|
||||
<channel site="syn.is" site_id="synsport5" lang="is" xmltv_id="Stod2Sport5.is@SD">Stöð 2 Sport 5</channel>
|
||||
<channel site="syn.is" site_id="synsport6" lang="is" xmltv_id="Stod2Sport6.is@SD">Stöð 2 Sport 6</channel>
|
||||
<channel site="syn.is" site_id="synsportisland" lang="is" xmltv_id=""></channel>
|
||||
<channel site="syn.is" site_id="synsportisland2" lang="is" xmltv_id=""></channel>
|
||||
<channel site="syn.is" site_id="synsportisland3" lang="is" xmltv_id=""></channel>
|
||||
<channel site="syn.is" site_id="synsportviaplay" lang="is" xmltv_id=""></channel>
|
||||
<channel site="syn.is" site_id="syn" lang="is" xmltv_id="">Sýn</channel>
|
||||
<channel site="syn.is" site_id="synsport" lang="is" xmltv_id="">Sýn Sport</channel>
|
||||
<channel site="syn.is" site_id="synsport2" lang="is" xmltv_id="">Sýn Sport2</channel>
|
||||
<channel site="syn.is" site_id="synsport3" lang="is" xmltv_id="">Sýn Sport3</channel>
|
||||
<channel site="syn.is" site_id="synsport4" lang="is" xmltv_id="">Sýn Sport4</channel>
|
||||
<channel site="syn.is" site_id="synsportisland" lang="is" xmltv_id="">Sýn Sport Ísland</channel>
|
||||
<channel site="syn.is" site_id="synsportisland2" lang="is" xmltv_id="">Sýn Sport Ísland 2</channel>
|
||||
<channel site="syn.is" site_id="synsportisland3" lang="is" xmltv_id="">Sýn Sport Ísland 3</channel>
|
||||
<channel site="syn.is" site_id="synsportviaplay" lang="is" xmltv_id="">Sýn Sport Viaplay</channel>
|
||||
</channels>
|
||||
|
||||
@@ -48,17 +48,33 @@ module.exports = {
|
||||
},
|
||||
async channels() {
|
||||
try {
|
||||
const response = await axios.get('https://www.syn.is/api/epg/')
|
||||
const response = await axios.get('https://www.syn.is/api/epg?type=schedule')
|
||||
if (!response.data || !Array.isArray(response.data)) {
|
||||
console.error('Error: No channels data found')
|
||||
return []
|
||||
}
|
||||
return response.data.map(item => {
|
||||
return {
|
||||
lang: 'is',
|
||||
site_id: item
|
||||
}
|
||||
})
|
||||
|
||||
const channels = await Promise.all(
|
||||
response.data.map(async item => {
|
||||
try {
|
||||
const { data: channelData } = await axios.get(`https://www.syn.is/api/epg/${item}`)
|
||||
if (!channelData?.[0]?.midill_heiti) {
|
||||
console.error(`Error: No name found for channel ${item}`)
|
||||
return null
|
||||
}
|
||||
return {
|
||||
lang: 'is',
|
||||
site_id: item,
|
||||
name: channelData[0].midill_heiti
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(`Error fetching channel name for ${item}:`, error)
|
||||
return null
|
||||
}
|
||||
})
|
||||
)
|
||||
|
||||
return channels.filter(Boolean)
|
||||
} catch (error) {
|
||||
console.error('Error fetching channels:', error)
|
||||
return []
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
const { parser, url } = require('./stod2.is.config.js')
|
||||
const { parser, url } = require('./syn.is.config.js')
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const dayjs = require('dayjs')
|
||||
@@ -12,7 +12,7 @@ dayjs.extend(timezone)
|
||||
|
||||
const date = dayjs.utc('2025-01-03', 'YYYY-MM-DD').startOf('day')
|
||||
const channel = { site_id: 'stod2', xmltv_id: 'Stod2.is' }
|
||||
|
||||
|
||||
it('can generate valid url', () => {
|
||||
const generatedUrl = url({ date, channel })
|
||||
expect(generatedUrl).toBe('https://www.syn.is/api/epg/stod2/2025-01-03')
|
||||
|
||||
Reference in New Issue
Block a user