continuing, WIP

This commit is contained in:
theofficialomega
2025-07-16 15:19:12 +02:00
parent d8e4372f22
commit 6b3e17861a
9 changed files with 14 additions and 21 deletions

View File

@@ -3,9 +3,7 @@ const utc = require('dayjs/plugin/utc')
const customParseFormat = require('dayjs/plugin/customParseFormat')
const parseDuration = require('parse-duration').default
const timezone = require('dayjs/plugin/timezone')
// importing custom function sortBy
const sortBy = require('../functions/functions')
const { sortBy } = require('../../scripts/functions')
dayjs.extend(customParseFormat)
dayjs.extend(utc)

View File

@@ -3,7 +3,7 @@ const dayjs = require('dayjs')
const utc = require('dayjs/plugin/utc')
const timezone = require('dayjs/plugin/timezone')
const customParseFormat = require('dayjs/plugin/customParseFormat')
const { uniqBy } = require('../../functions/functions')
const { uniqBy } = require('../../scripts/functions')
dayjs.extend(utc)
dayjs.extend(timezone)

View File

@@ -1,8 +1,10 @@
const axios = require('axios')
const cheerio = require('cheerio')
const dayjs = require('dayjs')
const utc = require('dayjs/plugin/utc')
const timezone = require('dayjs/plugin/timezone')
const customParseFormat = require('dayjs/plugin/customParseFormat')
const { uniqBy } = require('../../scripts/functions')
dayjs.extend(utc)
dayjs.extend(timezone)
@@ -41,9 +43,6 @@ module.exports = {
return programs
},
async channels() {
const axios = require('axios')
const _ = require('lodash')
const providers = ['-1', '-2', '-3']
const channels = []
@@ -77,7 +76,7 @@ module.exports = {
})
}
return _.uniqBy(channels, 'site_id')
return uniqBy(channels, 'site_id')
}
}

View File

@@ -1,8 +1,10 @@
const axios = require('axios')
const cheerio = require('cheerio')
const dayjs = require('dayjs')
const utc = require('dayjs/plugin/utc')
const timezone = require('dayjs/plugin/timezone')
const customParseFormat = require('dayjs/plugin/customParseFormat')
const { uniqBy } = require('../../scripts/functions')
dayjs.extend(utc)
dayjs.extend(timezone)
@@ -45,9 +47,6 @@ module.exports = {
return programs
},
async channels({ country }) {
const axios = require('axios')
const _ = require('lodash')
const providers = {
au: ['o', 'a'],
ca: [
@@ -147,7 +146,7 @@ module.exports = {
}
}
return _.uniqBy(channels, 'site_id')
return uniqBy(channels, 'site_id')
}
}

View File

@@ -2,7 +2,7 @@ const cheerio = require('cheerio')
const dayjs = require('dayjs')
const customParseFormat = require('dayjs/plugin/customParseFormat')
const timezone = require('dayjs/plugin/timezone')
const _ = require('lodash')
const { sortBy, uniqBy } = require('../../scripts/functions')
dayjs.extend(customParseFormat)
dayjs.extend(timezone)
@@ -29,7 +29,7 @@ module.exports = {
})
})
programs = _.orderBy(_.uniqBy(programs, 'start'), 'start')
programs = sortBy(uniqBy(programs, p => p.start), 'start')
return programs
},

View File

@@ -1,9 +1,6 @@
const { DateTime } = require('luxon')
const axios = require('axios')
// Remove the big lodash dependency by implementing a simple uniqBy function
// Complexity = O(n)
const uniqBy = (arr, fn) => [...new Map(arr.map(x => [fn(x), x])).values()]
const { uniqBy } = require('../../scripts/functions')
module.exports = {
site: 'tv.mail.ru',