mirror of
https://github.com/iptv-org/epg
synced 2026-04-17 08:09:23 -04:00
maintenance + update deps to mitigate critical updates
This commit is contained in:
2635
package-lock.json
generated
2635
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
48
package.json
48
package.json
@@ -41,19 +41,19 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@alex_neo/jest-expect-message": "^1.0.5",
|
||||
"@eslint/eslintrc": "^3.3.4",
|
||||
"@eslint/js": "^9.39.3",
|
||||
"@eslint/eslintrc": "^3.3.5",
|
||||
"@eslint/js": "^10.0.1",
|
||||
"@freearhey/chronos": "^0.0.1",
|
||||
"@freearhey/core": "^0.15.2",
|
||||
"@freearhey/search-js": "^0.2.0",
|
||||
"@freearhey/search-js": "^0.2.1",
|
||||
"@freearhey/storage-js": "^0.2.0",
|
||||
"@iptv-org/sdk": "^1.1.3",
|
||||
"@iptv-org/sdk": "^1.2.0",
|
||||
"@ntlab/sfetch": "^1.2.0",
|
||||
"@octokit/core": "^7.0.6",
|
||||
"@octokit/plugin-paginate-rest": "^14.0.0",
|
||||
"@octokit/plugin-rest-endpoint-methods": "^17.0.0",
|
||||
"@stylistic/eslint-plugin": "^5.9.0",
|
||||
"@swc/core": "^1.15.13",
|
||||
"@stylistic/eslint-plugin": "^5.10.0",
|
||||
"@swc/core": "^1.15.24",
|
||||
"@swc/jest": "^0.2.39",
|
||||
"@types/cli-progress": "^3.11.6",
|
||||
"@types/fs-extra": "^11.0.4",
|
||||
@@ -65,13 +65,13 @@
|
||||
"@types/lodash.sortby": "^4.7.9",
|
||||
"@types/lodash.startcase": "^4.4.9",
|
||||
"@types/lodash.uniqby": "^4.7.9",
|
||||
"@types/node": "^25.3.0",
|
||||
"@types/node": "^25.5.2",
|
||||
"@types/node-cleanup": "^2.1.5",
|
||||
"@types/numeral": "^2.0.5",
|
||||
"@types/pako": "^2.0.4",
|
||||
"@typescript-eslint/eslint-plugin": "^8.56.1",
|
||||
"@typescript-eslint/parser": "^8.56.1",
|
||||
"axios": "^1.13.5",
|
||||
"@typescript-eslint/eslint-plugin": "^8.58.0",
|
||||
"@typescript-eslint/parser": "^8.58.0",
|
||||
"axios": "^1.14.0",
|
||||
"axios-cookiejar-support": "^6.0.5",
|
||||
"axios-mock-adapter": "^2.1.0",
|
||||
"chalk": "^5.6.2",
|
||||
@@ -83,24 +83,24 @@
|
||||
"csv-parser": "^3.2.0",
|
||||
"curl-generator": "^0.5.0",
|
||||
"cwait": "^1.1.2",
|
||||
"dayjs": "^1.11.19",
|
||||
"dayjs": "^1.11.20",
|
||||
"epg-grabber": "^0.46.1",
|
||||
"epg-parser": "^0.5.0",
|
||||
"eslint": "^10.0.2",
|
||||
"eslint": "^10.2.0",
|
||||
"eslint-config-prettier": "^10.1.8",
|
||||
"form-data": "^4.0.5",
|
||||
"fs-extra": "^11.3.3",
|
||||
"fs-extra": "^11.3.4",
|
||||
"glob": "^13.0.6",
|
||||
"globals": "^17.3.0",
|
||||
"globals": "^17.4.0",
|
||||
"husky": "^9.1.7",
|
||||
"iconv-lite": "^0.7.2",
|
||||
"inquirer": "^13.3.0",
|
||||
"jest": "^30.2.0",
|
||||
"inquirer": "^13.3.2",
|
||||
"jest": "^30.3.0",
|
||||
"jest-offline": "^1.0.1",
|
||||
"langs": "^2.0.0",
|
||||
"libxml2-wasm": "^0.6.0",
|
||||
"libxml2-wasm": "^0.7.1",
|
||||
"lodash.merge": "^4.6.2",
|
||||
"lodash.orderby": "^4.6.0",
|
||||
"lodash.orderby": "^4.18.0",
|
||||
"lodash.sortby": "^4.7.0",
|
||||
"lodash.startcase": "^4.4.0",
|
||||
"lodash.uniqby": "^4.7.0",
|
||||
@@ -115,17 +115,17 @@
|
||||
"pm2": "^6.0.14",
|
||||
"readline": "^1.3.0",
|
||||
"run-script-os": "^1.1.6",
|
||||
"serve": "^14.2.5",
|
||||
"serve": "^14.2.6",
|
||||
"signale": "^1.4.0",
|
||||
"socks-proxy-agent": "^8.0.5",
|
||||
"socks-proxy-agent": "^10.0.0",
|
||||
"srcset": "^5.0.3",
|
||||
"table2array": "^0.0.2",
|
||||
"tabletojson": "^4.1.8",
|
||||
"tough-cookie": "^6.0.0",
|
||||
"tabletojson": "^4.1.9",
|
||||
"tough-cookie": "^6.0.1",
|
||||
"transliteration": "^2.6.1",
|
||||
"tsx": "^4.21.0",
|
||||
"typescript": "^5.9.3",
|
||||
"unzipit": "^1.4.3",
|
||||
"typescript": "^6.0.2",
|
||||
"unzipit": "^2.0.1",
|
||||
"uuid": "^13.0.0",
|
||||
"wildcard-match": "^5.1.4"
|
||||
}
|
||||
|
||||
@@ -84,8 +84,9 @@ module.exports = {
|
||||
}
|
||||
const path = currentRegion === 'pl' ? 'mycanalint' : 'mycanal'
|
||||
const diff = date.diff(dayjs.utc().startOf('d'), 'd')
|
||||
const token = canalToken[currentRegion]?.token
|
||||
|
||||
return `https://hodor.canalplus.pro/api/v2/${path}/channels/${canalToken[currentRegion].token}/${site_id}/broadcasts/day/${diff}`
|
||||
return `https://hodor.canalplus.pro/api/v2/${path}/channels/${token}/${site_id}/broadcasts/day/${diff}`
|
||||
},
|
||||
request:{
|
||||
headers() {
|
||||
@@ -157,7 +158,7 @@ async function parseToken(country) {
|
||||
const offerLocation = path.split('/')[1]
|
||||
const data = await axios.get(`https://hodor.canalplus.pro/api/v2/mycanal/authenticate.json/webapp/6.0?experiments=beta-test-one-tv-guide:control&offerZone=${offerZone}&offerLocation=${offerLocation}`, { headers: globalHeaders }
|
||||
).then(r => r.data).catch(console.error)
|
||||
return { country: country, token: data.token }
|
||||
return { country: country, token: data?.token }
|
||||
}
|
||||
switch(country) {
|
||||
// Canal + France
|
||||
@@ -176,8 +177,8 @@ async function parseToken(country) {
|
||||
timeout: 5000
|
||||
}).then(r => r.data).catch(console.error)
|
||||
|
||||
canalToken = { country: country, token: tokenData.token }
|
||||
return tokenData.token
|
||||
canalToken = { country: country, token: tokenData?.token }
|
||||
return tokenData?.token
|
||||
}
|
||||
|
||||
function parseStart(item) {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,40 +1,58 @@
|
||||
const cheerio = require('cheerio')
|
||||
const axios = require('axios')
|
||||
const dayjs = require('dayjs')
|
||||
const utc = require('dayjs/plugin/utc')
|
||||
|
||||
dayjs.extend(utc)
|
||||
|
||||
let token = null
|
||||
async function getToken() {
|
||||
if (token) return token
|
||||
token = await fetchToken()
|
||||
return token
|
||||
}
|
||||
|
||||
async function fetchToken() {
|
||||
return axios
|
||||
.post('https://api.cld.dtvce.com/authn-tokengo/v3/v2/tokens?client_id=DTVE_DFW_WEB_Chrome_G', { headers:
|
||||
{ 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/145.0.0.0 Safari/537.36' }
|
||||
})
|
||||
.then(r => r.data)
|
||||
.then(d => d.access_token)
|
||||
.catch(console.err)
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
site: 'directv.com',
|
||||
days: 2,
|
||||
request: {
|
||||
cache: {
|
||||
ttl: 60 * 60 * 1000 // 1 hour
|
||||
},
|
||||
headers: {
|
||||
'Accept-Language': 'en-US,en;q=0.5',
|
||||
Connection: 'keep-alive'
|
||||
request: async function() {
|
||||
return {
|
||||
cache: {
|
||||
ttl: 60 * 60 * 1000 // 1 hour
|
||||
},
|
||||
headers: {
|
||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/145.0.0.0 Safari/537.36',
|
||||
Authorization: `Bearer ${token}`,
|
||||
}
|
||||
}
|
||||
},
|
||||
url({ date, channel }) {
|
||||
const [channelId, childId] = channel.site_id.split('#')
|
||||
return `https://www.directv.com/json/channelschedule?channels=${channelId}&startTime=${date.format()}&hours=24&chId=${childId}`
|
||||
async url({ date, channel }) {
|
||||
await getToken()
|
||||
return `https://api.cld.dtvce.com/discovery/edge/schedule/v1/service/schedule?startTime=${date.format('YYYY-MM-DDT00:00:00')}&endTime=${date.add(24, 'hour').format('YYYY-MM-DDT00:00:00')}&channelIds=${channel.site_id}&include4K=false&is4Kcompatible=false&includeTVOD=true`
|
||||
},
|
||||
async parser({ content, channel }) {
|
||||
console.log(content)
|
||||
const programs = []
|
||||
const items = parseItems(content, channel)
|
||||
for (let item of items) {
|
||||
if (item.programID === '-1') continue
|
||||
const detail = await loadProgramDetail(item.programID)
|
||||
const start = parseStart(item)
|
||||
const stop = start.add(item.duration, 'm')
|
||||
programs.push({
|
||||
title: item.title,
|
||||
sub_title: item.episodeTitle,
|
||||
description: parseDescription(detail),
|
||||
description: parseDescription(item),
|
||||
rating: parseRating(item),
|
||||
date: parseYear(detail),
|
||||
date: parseYear(item),
|
||||
category: item.subcategoryList,
|
||||
season: item.seasonNumber,
|
||||
episode: item.episodeNumber,
|
||||
@@ -47,42 +65,43 @@ module.exports = {
|
||||
return programs
|
||||
},
|
||||
async channels() {
|
||||
const codes = [10001]
|
||||
// alternate https://www.directv.com/dtvassets/dtv/dev/uf/CHLUP/chnlListingPageData.json
|
||||
// though i don't think you could fetch the schedule from the API with this
|
||||
|
||||
let channels = []
|
||||
for (let code of codes) {
|
||||
const html = await axios
|
||||
.get('https://www.directv.com/guide', {
|
||||
headers: {
|
||||
cookie: `dtve-prospect-zip=${code}`
|
||||
}
|
||||
})
|
||||
.then(r => r.data)
|
||||
.catch(console.log)
|
||||
|
||||
const $ = cheerio.load(html)
|
||||
const script = $('#dtvClientData').html()
|
||||
const [, json] = script.match(/var dtvClientData = (.*);/) || [null, null]
|
||||
const data = JSON.parse(json)
|
||||
|
||||
data.guideData.channels.forEach(item => {
|
||||
channels.push({
|
||||
lang: 'en',
|
||||
site_id: item.chNum,
|
||||
name: item.chName
|
||||
})
|
||||
const html = await axios
|
||||
.get('https://api.cld.dtvce.com/discovery/metadata/channel/v5/service/allchannels?sort=OrdCh%253DASC', {
|
||||
headers: {
|
||||
Authorization: `Bearer ${await getToken()}`,
|
||||
'Accept-Language': 'en-US,en;q=0.5',
|
||||
Connection: 'keep-alive'
|
||||
}
|
||||
})
|
||||
}
|
||||
.then(r => r.data)
|
||||
.catch(console.log)
|
||||
|
||||
const data = html?.channelInfoList
|
||||
|
||||
if (data && Array.isArray(data)) {
|
||||
data.forEach(item => {
|
||||
channels.push({
|
||||
lang: 'en',
|
||||
site_id: item.resourceId,
|
||||
name: item.channelName,
|
||||
icon: item.imageList && item.imageList.length > 0 ? item.imageList[0].imageUrl : null
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
return channels
|
||||
}
|
||||
}
|
||||
|
||||
function parseDescription(detail) {
|
||||
return detail ? detail.description : null
|
||||
function parseDescription(item) {
|
||||
return item ? item.description : null
|
||||
}
|
||||
function parseYear(detail) {
|
||||
return detail ? detail.releaseYear : null
|
||||
function parseYear(item) {
|
||||
return item ? item.releaseYear : null
|
||||
}
|
||||
function parseRating(item) {
|
||||
return item.rating
|
||||
@@ -93,14 +112,7 @@ function parseRating(item) {
|
||||
: null
|
||||
}
|
||||
function parseImage(item) {
|
||||
return item.primaryImageUrl ? `https://www.directv.com${item.primaryImageUrl}` : null
|
||||
}
|
||||
function loadProgramDetail(programID) {
|
||||
return axios
|
||||
.get(`https://www.directv.com/json/program/flip/${programID}`)
|
||||
.then(r => r.data)
|
||||
.then(d => d.programDetail)
|
||||
.catch(console.err)
|
||||
return item.images?.length > 0 ? item.images[0].defaultImageUrl : null
|
||||
}
|
||||
|
||||
function parseStart(item) {
|
||||
@@ -108,11 +120,15 @@ function parseStart(item) {
|
||||
}
|
||||
|
||||
function parseItems(content, channel) {
|
||||
const data = JSON.parse(content)
|
||||
if (!data) return []
|
||||
if (!Array.isArray(data.schedule)) return []
|
||||
try {
|
||||
const data = JSON.parse(content)
|
||||
if (!data) return []
|
||||
if (!Array.isArray(data.schedules)) return []
|
||||
|
||||
const [, childId] = channel.site_id.split('#')
|
||||
const channelData = data.schedule.find(i => i.chId == childId)
|
||||
return channelData.schedules && Array.isArray(channelData.schedules) ? channelData.schedules : []
|
||||
const channelData = data.schedules.find(i => i.channelId === channel.site_id)
|
||||
return channelData?.contents && Array.isArray(channelData.contents) ? channelData.contents : []
|
||||
} catch (error) {
|
||||
console.error('Error parsing content:', error)
|
||||
return []
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user