mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-09 16:40:07 -04:00
Replaces icon with image
This commit is contained in:
parent
0eaff54a31
commit
bb6771f539
170 changed files with 428 additions and 351 deletions
|
@ -16,7 +16,7 @@ module.exports = {
|
|||
programs.push({
|
||||
title: item.title,
|
||||
description: parseDescription(item, channel.lang),
|
||||
icon: parseIcon(item),
|
||||
image: parseImage(item),
|
||||
start: parseStart(item),
|
||||
stop: parseStop(item)
|
||||
})
|
||||
|
@ -26,8 +26,9 @@ module.exports = {
|
|||
},
|
||||
async channels({ token, lang = en }) {
|
||||
const axios = require('axios')
|
||||
const ACCESS_TOKEN = token ? token :
|
||||
'MTM4MDY0NGUwZjFmYjZiMTRjODI4OTRhMGM2ODJkMTQ3ZTAxNWM5ZDoxZmI2YjE0YzgyODk0YTBjNjgyZDE0N2UwMTVjOWQ='
|
||||
const ACCESS_TOKEN = token
|
||||
? token
|
||||
: 'MTM4MDY0NGUwZjFmYjZiMTRjODI4OTRhMGM2ODJkMTQ3ZTAxNWM5ZDoxZmI2YjE0YzgyODk0YTBjNjgyZDE0N2UwMTVjOWQ='
|
||||
|
||||
const data = await axios
|
||||
.get(`https://tv.trueid.net/api/channel/getChannelListByAllCate?lang=${lang}&country=th`, {
|
||||
|
@ -52,10 +53,10 @@ module.exports = {
|
|||
|
||||
function parseDescription(item, lang) {
|
||||
const description = item.info?.[`synopsis_${lang}`]
|
||||
return description && description !== '.' ? description : null;
|
||||
return description && description !== '.' ? description : null
|
||||
}
|
||||
|
||||
function parseIcon(item) {
|
||||
function parseImage(item) {
|
||||
return item.info?.image || null
|
||||
}
|
||||
|
||||
|
@ -68,6 +69,6 @@ function parseStop(item) {
|
|||
}
|
||||
|
||||
function parseItems(content) {
|
||||
const data = content ? JSON.parse(content) : null;
|
||||
const data = content ? JSON.parse(content) : null
|
||||
return data?.pageProps?.epgList || []
|
||||
}
|
||||
|
|
|
@ -19,7 +19,9 @@ const data = fs.readFileSync(path.resolve(__dirname, '__data__/data.json'))
|
|||
|
||||
it('can generate valid url', () => {
|
||||
const result = url({ channel, date })
|
||||
expect(result).toBe('https://tv.trueid.net/_next/data/1380644e0f1fb6b14c82894a0c682d147e015c9d/th-en.json?channelSlug=true-movie-hits&path=true-movie-hits')
|
||||
expect(result).toBe(
|
||||
'https://tv.trueid.net/_next/data/1380644e0f1fb6b14c82894a0c682d147e015c9d/th-en.json?channelSlug=true-movie-hits&path=true-movie-hits'
|
||||
)
|
||||
})
|
||||
|
||||
it('can parse English response', () => {
|
||||
|
@ -34,7 +36,7 @@ it('can parse English response', () => {
|
|||
title: 'The Last Witch Hunter',
|
||||
description:
|
||||
'A young man is all that stands between humanity and the most horrifying witches in history.',
|
||||
icon: 'https://bms.dmpcdn.com/uploads/pic/381f853da5f4a310bf248357fed21a57.jpg'
|
||||
image: 'https://bms.dmpcdn.com/uploads/pic/381f853da5f4a310bf248357fed21a57.jpg'
|
||||
})
|
||||
})
|
||||
|
||||
|
@ -50,7 +52,7 @@ it('can parse Thai response', () => {
|
|||
title: 'The Last Witch Hunter',
|
||||
description:
|
||||
'หนุ่มนักล่าแม่มดถูกสาปให้เป็นอมตะจนกระทั่งราชินีแม่มดได้ฟื้นคืนชีพขึ้นมาจึงมีเพียงเขาคนเดียวเท่านั้นที่จะสามารถกอบกู้มวลมนุษยชาติได้',
|
||||
icon: 'https://bms.dmpcdn.com/uploads/pic/381f853da5f4a310bf248357fed21a57.jpg'
|
||||
image: 'https://bms.dmpcdn.com/uploads/pic/381f853da5f4a310bf248357fed21a57.jpg'
|
||||
})
|
||||
})
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue