Fix linter issues in sites/

This commit is contained in:
freearhey
2025-01-01 12:27:22 +03:00
parent d6d20b6413
commit 5df982bb7c
129 changed files with 3316 additions and 3226 deletions

View File

@@ -24,15 +24,7 @@ module.exports = {
debug('Got build id', module.exports.buildId)
}
const channelId = channel.site_id.replace('/', '--')
return `https://tvplus.com.tr/_next/data/${
module.exports.buildId
}/${
channel.lang
}/canli-tv/yayin-akisi/${
channelId
}.json?title=${
channelId
}`
return `https://tvplus.com.tr/_next/data/${module.exports.buildId}/${channel.lang}/canli-tv/yayin-akisi/${channelId}.json?title=${channelId}`
},
parser({ content, date }) {
const programs = []
@@ -43,7 +35,9 @@ module.exports = {
.filter(i => i.length && i[0].starttime.startsWith(date.format('YYYY-MM-DD')))
.forEach(i => {
for (const schedule of i) {
const [, season, episode] = schedule.seasonInfo?.match(/(\d+)\. Sezon \- (\d+)\. Bölüm/) || [null, null, null]
const [, season, episode] = schedule.seasonInfo?.match(
/(\d+)\. Sezon - (\d+)\. Bölüm/
) || [null, null, null]
programs.push({
title: schedule.name,
description: schedule.introduce,
@@ -69,14 +63,19 @@ module.exports = {
.catch(console.error)
const $ = cheerio.load(data)
$('.channel-list-item a').toArray()
$('.channel-list-item a')
.toArray()
.forEach(el => {
const a = $(el)
channels.push({
lang: 'tr',
name: a.attr('title').replace(/Yayın Akışı/, '').trim(),
site_id: a.attr('href')
.replace(/\/canli\-tv\/yayin\-akisi\//, '')
name: a
.attr('title')
.replace(/Yayın Akışı/, '')
.trim(),
site_id: a
.attr('href')
.replace(/\/canli-tv\/yayin-akisi\//, '')
.replace('--', '/') // change -- to / as it used in xml comment
})
})

View File

@@ -18,7 +18,7 @@ const channel = {
xmltv_id: 'NickJr.tr'
}
axios.get.mockImplementation((url, opts) => {
axios.get.mockImplementation(url => {
if (url === 'https://tvplus.com.tr/canli-tv/yayin-akisi') {
return Promise.resolve({
data: fs.readFileSync(path.join(__dirname, '__data__', 'build.html')).toString()
@@ -27,17 +27,18 @@ axios.get.mockImplementation((url, opts) => {
})
it('can generate valid url', async () => {
expect(await url({ channel })).toBe('https://tvplus.com.tr/_next/data/kUzvz_bbQJNaShlFUkrR3/tr/canli-tv/yayin-akisi/nick-jr--4353.json?title=nick-jr--4353')
expect(await url({ channel })).toBe(
'https://tvplus.com.tr/_next/data/kUzvz_bbQJNaShlFUkrR3/tr/canli-tv/yayin-akisi/nick-jr--4353.json?title=nick-jr--4353'
)
})
it('can parse response', () => {
const content = fs.readFileSync(path.join(__dirname, '__data__', 'content.json'))
const results = parser({ date, channel, content })
.map(p => {
p.start = p.start.toJSON()
p.stop = p.stop.toJSON()
return p
})
const results = parser({ date, channel, content }).map(p => {
p.start = p.start.toJSON()
p.stop = p.stop.toJSON()
return p
})
expect(results.length).toBe(88)
expect(results[0]).toMatchObject({
@@ -45,7 +46,7 @@ it('can parse response', () => {
stop: '2024-12-14T21:20:00.000Z',
title: 'Camgöz (2020)',
description:
'Max\'in Camgöz adında yarı köpek balığı yarı köpek eşsiz bir evcil havyanı vardır. İlk başlarda Camgöz\'ü saklamaya çalışsa da Sisli Pınarlar\'da, en iyi arkadaşlar, meraklı komşular ve hatta Max\'in ailesi bile yaramaz yeni arkadaşını fark edecektir.',
"Max'in Camgöz adında yarı köpek balığı yarı köpek eşsiz bir evcil havyanı vardır. İlk başlarda Camgöz'ü saklamaya çalışsa da Sisli Pınarlar'da, en iyi arkadaşlar, meraklı komşular ve hatta Max'in ailesi bile yaramaz yeni arkadaşını fark edecektir.",
image:
'https://gbzeottvsc01.tvplus.com.tr:33207/CPS/images/universal/film/program/202412/20241209/21/2126356250845eb88428_0_XL.jpg',
category: 'Çocuk',