Merge pull request #2605 from iptv-org/add-jiotv.com

Add jiotv.com
This commit is contained in:
PopeyeTheSai10r authored and GitHub committed 2025-01-17 20:41:27 -08:00
commit 9a4fe43729
5 files changed
+1292

No files matched your search

+1
View File
@@ -0,0 +1 @@
{"epg":[{"srno":250117146000,"showId":"CHN-007390000PRG-551148801","showtime":"00:00:00","showname":"History's Greatest Escapes with Morgan Freeman","description":"Celebrated actor and host Morgan Freeman revisits some of the most daring jailbreaks conducted by ingenuous prisoners from across the globe.","director":"Mitch Marcus","starCast":"","duration":43,"endtime":"00:43:00","showCategory":"TV Show","showGenre":["Crime"],"episode_num":4,"willRepeat":true,"episode_desc":"During World War II, Nazi death camps terrorise Europe. Subsequently, at Sobibor in Poland, Jewish prisoners forced to operate the killing machinery refuse to accept their fate.","isCatchupAvailable":true,"twitter_handle":"","keywords":["Imprisoned","Prison","Prison Break","Prison film","Set in a prison","Escape","Survival","Survival Instinct"],"premiumText":"","isCam":0,"pcr":"\n","channel_id":146,"startTime":0,"showLanguageId":6,"showCategoryId":1,"renderImage":false,"episodeThumbnail":"2025-01-17/250117146000_s.jpg","episodePoster":"2025-01-17/250117146000.jpg","isLiveAvailable":true,"canRecord":true,"canRecordStb":true,"stbCatchupAvailable":true,"isDownloadable":false,"startEpoch":1737052200000,"endEpoch":1737054780000,"channel_name":"History TV18 HD","is_premium":false,"plan_type":"free","business_type":"free","isPastEpisode":true},{"srno":250117146001,"showId":"CHN-007390000PRG-551083324","showtime":"00:43:00","showname":"History's Greatest Heists With Pierce Brosnan","description":"The host sheds light on elaborate and infamous heists that have taken place throughout history and the masterminds behind them.","director":"Brendan G Murphy","starCast":"Brent Picha, William Sibley, Bobby Williams","duration":44,"endtime":"01:27:00","showCategory":"Documentary","showGenre":["History"],"episode_num":3,"willRepeat":true,"episode_desc":"Daring criminals burrow beneath London's streets to infiltrate a Lloyds Bank vault. However, their heist takes an unexpected turn when a radio hobbyist stumbles upon their communications.","isCatchupAvailable":true,"twitter_handle":"","keywords":["Heist","Criminal mastermind","Consequences","Historical account","Historical significance","Criminal offence"],"premiumText":"","isCam":0,"pcr":"\n","channel_id":146,"startTime":43,"showLanguageId":6,"showCategoryId":7,"renderImage":false,"episodeThumbnail":"2025-01-17/250117146001_s.jpg","episodePoster":"2025-01-17/250117146001.jpg","isLiveAvailable":true,"canRecord":true,"canRecordStb":true,"stbCatchupAvailable":true,"isDownloadable":false,"startEpoch":1737054780000,"endEpoch":1737057420000,"channel_name":"History TV18 HD","is_premium":false,"plan_type":"free","business_type":"free","isPastEpisode":true},{"srno":250117146002,"showId":"CHN-007390000PRG-551138162","showtime":"01:27:00","showname":"Pawn Stars - Out & About","description":"Popular pawn merchants from a grand shop in Las Vegas connect with fans in eight different cities and acquire some of the most remarkable items.","director":"","starCast":"","duration":21,"endtime":"01:48:00","showCategory":"TV Show","showGenre":["Reality Show"],"episode_num":5,"willRepeat":true,"episode_desc":"","isCatchupAvailable":true,"twitter_handle":"","keywords":["Antiques","Possessions","Customer","Client","Pawnbroker"],"premiumText":"","isCam":0,"pcr":"\n","channel_id":146,"startTime":87,"showLanguageId":6,"showCategoryId":1,"renderImage":false,"episodeThumbnail":"2025-01-17/250117146002_s.jpg","episodePoster":"2025-01-17/250117146002.jpg","isLiveAvailable":true,"canRecord":true,"canRecordStb":true,"stbCatchupAvailable":true,"isDownloadable":false,"startEpoch":1737057420000,"endEpoch":1737058680000,"channel_name":"History TV18 HD","is_premium":false,"plan_type":"free","business_type":"free","isPastEpisode":true},{"srno":250117146003,"showId":"CHN-007390000PRG-550697376","showtime":"01:48:00","showname":"Kings Of Pain","description":"A biologist and a professional animal handler set out to create a pain index. To do this, they allow deadly animals to bite or sting them, after which they rate them on a scale for future reference.","director":"","starCast":"","duration":42,"endtime":"02:30:00","showCategory":"Documentary","showGenre":["Factual Entertainment"],"episode_num":7,"willRepeat":true,"episode_desc":"Rob and Adam take on Blue tang, peacock mantis shrimp and double bar rabbitfish which are commonly seen in home aquariums.","isCatchupAvailable":true,"twitter_handle":"","keywords":["Animals","Volunteer","Research","Expert analysis","Experiences"],"premiumText":"","isCam":0,"pcr":"\n","channel_id":146,"startTime":108,"showLanguageId":6,"showCategoryId":7,"renderImage":false,"episodeThumbnail":"2025-01-17/250117146003_s.jpg","episodePoster":"2025-01-17/250117146003.jpg","isLiveAvailable":true,"canRecord":true,"canRecordStb":true,"stbCatchupAvailable":true,"isDownloadable":false,"startEpoch":1737058680000,"endEpoch":1737061200000,"channel_name":"History TV18 HD","is_premium":false,"plan_type":"free","business_type":"free"Line truncated
File diff suppressed because it is too large. Load diff
+87
View File
@@ -0,0 +1,87 @@
const axios = require('axios')
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)
module.exports = {
site: 'jiotv.com',
days: 2,
url({ date, channel }) {
const offset = date.diff(dayjs.utc().startOf('d'), 'd')
return `https://jiotvapi.cdn.jio.com/apis/v1.3/getepg/get?channel_id=${channel.site_id}&offset=${offset}`
},
parser({ content }) {
let programs = []
let items = parseItems(content)
items.forEach(item => {
programs.push({
title: item.showname,
description: item.episode_desc || item.description,
directors: parseList(item.director),
actors: parseList(item.starCast),
categories: item.showGenre,
episode: parseEpisode(item),
keywords: item.keywords,
icon: parseIcon(item),
image: parseImage(item),
start: dayjs(item.startEpoch),
stop: dayjs(item.endEpoch)
})
})
return programs
},
async channels() {
const data = await axios
.get(
'https://jiotvapi.cdn.jio.com/apis/v3.0/getMobileChannelList/get/?langId=6&devicetype=phone&os=android&usertype=JIO&version=343'
)
.then(r => r.data)
.catch(console.error)
return data.result.map(c => {
return {
lang: 'en',
site_id: c.channel_id,
name: c.channel_name
}
})
}
}
function parseEpisode(item) {
return item.episode_num > 0 ? item.episode_num : null
}
function parseList(string) {
return string.split(', ').filter(Boolean)
}
function parseIcon(item) {
return item.episodeThumbnail
? `https://jiotvimages.cdn.jio.com/dare_images/shows/700/-/${item.episodeThumbnail}`
: null
}
function parseImage(item) {
return item.episodePoster
? `https://jiotvimages.cdn.jio.com/dare_images/shows/700/-/${item.episodePoster}`
: null
}
function parseItems(content) {
try {
const data = JSON.parse(content)
if (!data || !Array.isArray(data.epg)) return []
return data.epg
} catch {
return []
}
}
+86
View File
@@ -0,0 +1,86 @@
const { parser, url } = require('./jiotv.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)
jest.useFakeTimers().setSystemTime(new Date('2025-01-15'))
const date = dayjs.utc('2025-01-17', 'YYYY-MM-DD').startOf('d')
const channel = {
site_id: '146',
xmltv_id: 'HistoryTV18HD.in'
}
it('can generate valid url', () => {
expect(url({ date, channel })).toBe(
'https://jiotvapi.cdn.jio.com/apis/v1.3/getepg/get?channel_id=146&offset=2'
)
})
it('can parse response', () => {
const content = fs.readFileSync(path.resolve(__dirname, '__data__/content.json'), 'utf8')
let results = parser({ content })
results = results.map(p => {
p.start = p.start.toJSON()
p.stop = p.stop.toJSON()
return p
})
expect(results.length).toBe(46)
expect(results[1]).toMatchObject({
start: '2025-01-16T19:13:00.000Z',
stop: '2025-01-16T19:57:00.000Z',
title: "History's Greatest Heists With Pierce Brosnan",
description:
"Daring criminals burrow beneath London's streets to infiltrate a Lloyds Bank vault. However, their heist takes an unexpected turn when a radio hobbyist stumbles upon their communications.",
categories: ['History'],
directors: ['Brendan G Murphy'],
actors: ['Brent Picha', 'William Sibley', 'Bobby Williams'],
episode: 3,
keywords: [
'Heist',
'Criminal mastermind',
'Consequences',
'Historical account',
'Historical significance',
'Criminal offence'
],
icon: 'https://jiotvimages.cdn.jio.com/dare_images/shows/700/-/2025-01-17/250117146001_s.jpg',
image: 'https://jiotvimages.cdn.jio.com/dare_images/shows/700/-/2025-01-17/250117146001.jpg'
})
expect(results[45]).toMatchObject({
start: '2025-01-17T18:29:00.000Z',
stop: '2025-01-17T18:29:59.000Z',
title: "History's Greatest Escapes with Morgan Freeman",
description:
'In French Guiana, when petty thief Rene Belbenoit faces harsh imprisonment, determined to break free, he endures years of gruelling conditions and attempts numerous daring escapes.',
categories: ['Crime'],
directors: ['Mitch Marcus'],
actors: [],
episode: 5,
keywords: [
'Imprisoned',
'Prison',
'Prison Break',
'Prison film',
'Set in a prison',
'Escape',
'Survival',
'Survival Instinct'
],
icon: 'https://jiotvimages.cdn.jio.com/dare_images/shows/700/-/2025-01-17/250117146045_s.jpg',
image: 'https://jiotvimages.cdn.jio.com/dare_images/shows/700/-/2025-01-17/250117146045.jpg'
})
})
it('can handle empty guide', () => {
const results = parser({
content: ''
})
expect(results).toMatchObject([])
})
+21
View File
@@ -0,0 +1,21 @@
# jiotv.com
https://www.jiotv.com/tv-guide
### Download the guide
```sh
npm run grab --- --site=jiotv.com
```
### Update channel list
```sh
npm run channels:parse --- --config=./sites/jiotv.com/jiotv.com.config.js --output=./sites/jiotv.com/jiotv.com.channels.xml
```
### Test
```sh
npm test --- jiotv.com
```