Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[OVERALL] Maintenance update #2390

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14,699 changes: 0 additions & 14,699 deletions package-lock.json

This file was deleted.

74 changes: 37 additions & 37 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,61 +30,61 @@
"@alex_neo/jest-expect-message": "^1.0.5",
"@freearhey/core": "^0.3.1",
"@freearhey/search-js": "^0.1.1",
"@octokit/core": "^4.1.0",
"@types/cli-progress": "^3.11.3",
"@types/fs-extra": "^11.0.2",
"@types/inquirer": "^9.0.3",
"@types/jest": "^29.5.5",
"@types/lodash": "^4.14.199",
"@types/node-cleanup": "^2.1.2",
"@types/numeral": "^2.0.3",
"@typescript-eslint/eslint-plugin": "^6.7.3",
"axios": "^1.5.1",
"axios-cookiejar-support": "^4.0.7",
"chalk": "^4.1.2",
"cheerio": "^1.0.0-rc.10",
"@octokit/core": "^6.1.2",
"@types/cli-progress": "^3.11.5",
"@types/fs-extra": "^11.0.4",
"@types/inquirer": "^9.0.7",
"@types/jest": "^29.5.12",
"@types/node-cleanup": "^2.1.5",
"@types/numeral": "^2.0.5",
"@typescript-eslint/eslint-plugin": "^7.13.1",
"axios": "^1.7.2",
"axios-cookiejar-support": "^5.0.2",
"chalk": "^5.3.0",
"cheerio": "^1.0.0-rc.12",
"cli-progress": "^3.12.0",
"commander": "^8.2.0",
"commander": "^12.1.0",
"consola": "^3.2.3",
"cron": "^2.4.3",
"cron": "^3.1.7",
"csv-parser": "^3.0.0",
"cwait": "^1.1.2",
"dayjs": "^1.11.10",
"dayjs": "^1.11.11",
"epg-grabber": "^0.36.1",
"epg-parser": "^0.2.0",
"eslint": "^8.17.0",
"eslint-config-prettier": "^9.0.0",
"epg-parser": "^0.3.1",
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.1.0",
"form-data": "^4.0.0",
"fs-extra": "^10.0.1",
"glob": "^7.2.0",
"iconv-lite": "^0.4.24",
"inquirer": "^8.2.6",
"fs-extra": "^11.2.0",
"glob": "^10.4.2",
"iconv-lite": "^0.6.3",
"inquirer": "^9.2.23",
"jest": "^29.7.0",
"langs": "^2.0.0",
"libxmljs2": "^0.33.0",
"lodash": "^4.17.21",
"luxon": "^3.3.0",
"luxon": "^3.4.4",
"markdown-include": "^0.4.3",
"mockdate": "^3.0.5",
"nedb-promises": "^6.0.3",
"nedb-promises": "^6.2.3",
"node-cleanup": "^2.1.2",
"node-gzip": "^1.1.2",
"numeral": "^2.0.6",
"parse-duration": "^1.0.0",
"parse-duration": "^1.1.0",
"pdf-parse": "^1.1.1",
"serve": "^14.2.0",
"serve": "^14.2.3",
"signale": "^1.4.0",
"srcset": "^4.0.0",
"srcset": "^5.0.1",
"table2array": "^0.0.2",
"tabletojson": "^2.0.7",
"tough-cookie": "^4.1.3",
"transliteration": "^2.2.0",
"ts-jest": "^29.1.1",
"tsx": "^3.13.0",
"unzipit": "^1.4.0",
"wildcard-match": "^5.1.2"
"tabletojson": "^4.1.4",
"tough-cookie": "^4.1.4",
"transliteration": "^2.3.5",
"ts-jest": "^29.1.5",
"tsx": "^4.15.7",
"unzipit": "^1.4.3",
"wildcard-match": "^5.1.3"
},
"devDependencies": {
"run-script-os": "^1.1.6"
"@typescript-eslint/parser": "^7.13.1",
"run-script-os": "^1.1.6",
"typescript": "^5.5.2"
}
}
3 changes: 1 addition & 2 deletions scripts/core/configLoader.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { SiteConfig } from 'epg-grabber'
import _ from 'lodash'
import { pathToFileURL } from 'url'

export class ConfigLoader {
Expand Down Expand Up @@ -28,6 +27,6 @@ export class ConfigLoader {
channels: undefined
}

return _.merge(defaultConfig, config)
return { ...defaultConfig, ...config }
}
}
3 changes: 1 addition & 2 deletions sites/digiturk.com.tr/digiturk.com.tr.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
const _ = require('lodash')
const dayjs = require('dayjs')
const utc = require('dayjs/plugin/utc')
const timezone = require('dayjs/plugin/timezone')
Expand Down Expand Up @@ -56,7 +55,7 @@ module.exports = {
})
})

programs = _.sortBy(programs, 'start')
programs.sort((a, b) => new Date(a.start) - new Date(b.start))

return programs
},
Expand Down
4 changes: 1 addition & 3 deletions sites/dstv.com/dstv.com.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ module.exports = {
return programs
},
async channels({ country }) {
const _ = require('lodash')

const countries = {
ao: 'ago',
bj: 'ben',
Expand Down Expand Up @@ -114,7 +112,7 @@ module.exports = {
})
})

return _.uniqBy(channels, 'site_id')
return [...new Map(channels.map(item => [item.site_id, item])).values()];
}
}

Expand Down
3 changes: 1 addition & 2 deletions sites/guida.tv/guida.tv.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ module.exports = {
},
async channels() {
const axios = require('axios')
const _ = require('lodash')

const providers = ['-1', '-2', '-3']

Expand Down Expand Up @@ -77,7 +76,7 @@ module.exports = {
})
}

return _.uniqBy(channels, 'site_id')
return [...new Map(channels.map(item => [item.site_id, item])).values()]
}
}

Expand Down
1 change: 0 additions & 1 deletion sites/mncvision.id/mncvision.id.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
const _ = require('lodash')
const axios = require('axios')
const cheerio = require('cheerio')
const dayjs = require('dayjs')
Expand Down
3 changes: 1 addition & 2 deletions sites/mytelly.co.uk/mytelly.co.uk.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ module.exports = {
},
async channels() {
const axios = require('axios')
const _ = require('lodash')

const providers = [
'-3000053',
Expand Down Expand Up @@ -111,7 +110,7 @@ module.exports = {
}
}

return _.uniqBy(channels, 'site_id')
return [...new Map(channels.map(item => [item.site_id, item])).values()]
}
}

Expand Down
3 changes: 1 addition & 2 deletions sites/ontvtonight.com/ontvtonight.com.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ module.exports = {
},
async channels({ country }) {
const axios = require('axios')
const _ = require('lodash')

const providers = {
au: ['o', 'a'],
Expand Down Expand Up @@ -146,7 +145,7 @@ module.exports = {
}
}

return _.uniqBy(channels, 'site_id')
return [...new Map(channels.map(item => [item.site_id, item])).values()]
}
}

Expand Down
25 changes: 11 additions & 14 deletions sites/osn.com/osn.com.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ module.exports = {
site: 'osn.com',
days: 2,
url({ channel, date }) {
return `https://www.osn.com/api/TVScheduleWebService.asmx/GetTVChannelsProgramTimeTable?newDate=${encodeURIComponent(
return `https://www.osn.com/api/TVScheduleWebService.asmx/time?dt=${encodeURIComponent(
date.format('MM/DD/YYYY')
)}&selectedCountry=AE&channelCode=${channel.site_id}&isMobile=false&hoursForMobile=0`
)}&co=AE&ch=${channel.site_id}&mo=false&hr=0`
},
request: {
headers({ channel }) {
Expand Down Expand Up @@ -39,18 +39,15 @@ module.exports = {
},
async channels({ lang = 'ar' }) {
const axios = require('axios')
const result = await axios
.get('https://www.osn.com/api/tvchannels.ashx?culture=en-US&packageId=3519&country=AE')
.then(response => response.data)
.catch(console.error)
const pages = Array.from({ length: 9 }, (_, i) => i + 1);
const results = await Promise.all(pages.map(pg => axios.get(`https://www.osn.com/api/TVScheduleWebService.asmx/chnl?pg=${pg}&pk=0&gn=0&cu=ar-AE&bx=1&dt=${encodeURIComponent(
date.format('MM/DD/YYYY'))}`).then(response => response.data).catch(console.error)));

const channels = result.map(channel => {
return {
lang: lang,
site_id: channel.channelCode,
name: channel.channeltitle
}
})
const channels = results.flat().filter(Boolean).map(channel => ({
lang: lang,
site_id: channel.channelCode,
name: channel.channeltitle
}));

return channels
}
Expand All @@ -76,4 +73,4 @@ function parseStart(item) {

function parseItems(content) {
return content ? JSON.parse(content) : []
}
}
2 changes: 1 addition & 1 deletion sites/osn.com/osn.com.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ it('can generate valid request headers', () => {
it('can generate valid url', () => {
const result = url({ channel: channelAR, date })
expect(result).toBe(
'https://www.osn.com/api/TVScheduleWebService.asmx/GetTVChannelsProgramTimeTable?newDate=10%2F24%2F2021&selectedCountry=AE&channelCode=AAN&isMobile=false&hoursForMobile=0'
'https://www.osn.com/api/TVScheduleWebService.asmx/time?dt=10%2F24%2F2021&co=AE&ch=AAN&mo=false&hr=0'
)
})

Expand Down
4 changes: 2 additions & 2 deletions sites/reportv.com.ar/reportv.com.ar.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ const cheerio = require('cheerio')
const utc = require('dayjs/plugin/utc')
const timezone = require('dayjs/plugin/timezone')
const customParseFormat = require('dayjs/plugin/customParseFormat')
const _ = require('lodash')

dayjs.extend(utc)
dayjs.extend(timezone)
Expand Down Expand Up @@ -164,7 +163,8 @@ function parseDuration($item) {
function parseItems(content, date) {
if (!content) return []
const $ = cheerio.load(content)
const d = _.startCase(date.locale('es').format('DD MMMM YYYY'))
const d = new Intl.DateTimeFormat('es', { day: '2-digit', month: 'long', year: 'numeric' })
.format(new Date()).replace(/\b\w/g, char => char.toUpperCase());

return $(`.trProg[title*="${d}"]`).toArray()
}
4 changes: 2 additions & 2 deletions sites/rev.bs/rev.bs.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
const _ = require('lodash')
const axios = require('axios')
const dayjs = require('dayjs')
const utc = require('dayjs/plugin/utc')
Expand All @@ -20,7 +19,8 @@ module.exports = {
const items1 = parseItems(await loadNextItems(date, 1), channel)
const items2 = parseItems(await loadNextItems(date, 2), channel)
const items3 = parseItems(await loadNextItems(date, 3), channel)
const items = _.unionBy(items0, items1, items2, items3, 'sid')
const unionBy = (key, ...arrays) => [...new Map(arrays.flat().map(item => [item[key], item])).values()];
const items = unionBy('sid', items0, items1, items2, items3);
items.forEach(item => {
const start = parseStart(item, date)
const stop = start.add(item.duration, 'm')
Expand Down
3 changes: 1 addition & 2 deletions sites/rtp.pt/rtp.pt.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
const _ = require('lodash')
const axios = require('axios')
const dayjs = require('dayjs')
const utc = require('dayjs/plugin/utc')
Expand Down Expand Up @@ -63,5 +62,5 @@ function parseItems(content) {
if (!content) return []
const data = JSON.parse(content)

return _.flatten(Object.values(data.result))
return Object.values(data.result).flat();
}
4 changes: 1 addition & 3 deletions sites/startimestv.com/startimestv.com.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ module.exports = {
return programs
},
async channels() {
const _ = require('lodash')

const areas = [6, 2, 3, 4, 5, 32, 14, 22, 12, 9, 16, 11, 13, 15, 20, 19]

const channels = []
Expand Down Expand Up @@ -63,7 +61,7 @@ module.exports = {
})
}

return _.uniqBy(channels, 'site_id')
return [...new Map(channels.map(channel => [channel.site_id, channel])).values()]
}
}

Expand Down
4 changes: 2 additions & 2 deletions sites/streamingtvguides.com/streamingtvguides.com.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ const cheerio = require('cheerio')
const dayjs = require('dayjs')
const customParseFormat = require('dayjs/plugin/customParseFormat')
const timezone = require('dayjs/plugin/timezone')
const _ = require('lodash')

dayjs.extend(customParseFormat)
dayjs.extend(timezone)
Expand All @@ -29,7 +28,8 @@ module.exports = {
})
})

programs = _.orderBy(_.uniqBy(programs, 'start'), 'start')
programs = [...new Map(programs.map(program => [program.start, program])).values()]
.sort((a, b) => new Date(a.start) - new Date(b.start))

return programs
},
Expand Down
4 changes: 1 addition & 3 deletions sites/tv.mail.ru/tv.mail.ru.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ module.exports = {
return programs
},
async channels() {
const _ = require('lodash')

const regions = [5506, 1096, 1125, 285]

let channels = []
Expand Down Expand Up @@ -64,7 +62,7 @@ module.exports = {
}
}

return _.uniqBy(channels, 'site_id')
return [...new Map(channels.map(channel => [channel.site_id, channel])).values()]
}
}

Expand Down
3 changes: 1 addition & 2 deletions sites/tvcesoir.fr/tvcesoir.fr.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ module.exports = {
},
async channels() {
const axios = require('axios')
const _ = require('lodash')

const providers = ['-1', '-2', '-3', '-4', '-5']

Expand Down Expand Up @@ -77,7 +76,7 @@ module.exports = {
})
}

return _.uniqBy(channels, 'site_id')
return [...new Map(channels.map(channel => [channel.site_id, channel])).values()];
}
}

Expand Down
3 changes: 1 addition & 2 deletions sites/tvhebdo.com/tvhebdo.com.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ module.exports = {
return programs
},
async channels() {
const _ = require('lodash')

let items = []
const offsets = [
Expand Down Expand Up @@ -72,7 +71,7 @@ module.exports = {
})
})

return _.uniqBy(channels, 'site_id')
return [...new Map(channels.map(channel => [channel.site_id, channel])).values()]
}
}

Expand Down
Loading