Replace LF line endings with CRLF

This commit is contained in:
freearhey
2025-09-28 17:55:05 +03:00
parent efc74efcf8
commit b6a589c62a
1192 changed files with 445631 additions and 445631 deletions
+21 -21
View File
@@ -1,21 +1,21 @@
# tvarenasport.com
https://www.tvarenasport.com/tv-scheme
### Download the guide
```sh
npm run grab --- --site=tvarenasport.com
```
### Update channel list
```sh
npm run channels:parse --- --config=./sites/tvarenasport.com/tvarenasport.com.config.js --output=./sites/tvarenasport.com/tvarenasport.com.channels.xml
```
### Test
```sh
npm test --- tvarenasport.com
```
# tvarenasport.com
https://www.tvarenasport.com/tv-scheme
### Download the guide
```sh
npm run grab --- --site=tvarenasport.com
```
### Update channel list
```sh
npm run channels:parse --- --config=./sites/tvarenasport.com/tvarenasport.com.config.js --output=./sites/tvarenasport.com/tvarenasport.com.channels.xml
```
### Test
```sh
npm test --- tvarenasport.com
```
@@ -1,21 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<channels>
<channel site="tvarenasport.com" lang="sr" xmltv_id="ArenaSport1Premium.rs" site_id="a1p" logo="https://www.tvarenasport.com/files/img/icons/chanel-a1p.png">Arena Sport 1 Premium Serbia</channel>
<channel site="tvarenasport.com" lang="sr" xmltv_id="ArenaSport2Premium.rs" site_id="a2p" logo="https://www.tvarenasport.com/files/img/icons/chanel-a2p.png">Arena Sport 2 Premium Serbia</channel>
<channel site="tvarenasport.com" lang="sr" xmltv_id="ArenaSport3Premium.rs" site_id="a3p" logo="https://www.tvarenasport.com/files/img/icons/chanel-a3p.png">Arena Sport 3 Premium Serbia</channel>
<channel site="tvarenasport.com" lang="sr" xmltv_id="ArenaSport4Premium.rs" site_id="a4p" logo="https://www.tvarenasport.com/files/img/icons/chanel-a4p.png">Arena Sport 4 Premium Serbia</channel>
<channel site="tvarenasport.com" lang="sr" xmltv_id="ArenaSport5Premium.rs" site_id="aa5p" logo="https://www.tvarenasport.com/files/img/icons/chanel-aa5p.png">Arena Sport 5 Premium Serbia</channel>
<channel site="tvarenasport.com" lang="sr" xmltv_id="ArenaSport1.rs" site_id="01" logo="https://www.tvarenasport.com/files/img/icons/chanel-01.png">Arena Sport 1 Serbia</channel>
<channel site="tvarenasport.com" lang="sr" xmltv_id="ArenaSport2.rs" site_id="02" logo="https://www.tvarenasport.com/files/img/icons/chanel-02.png">Arena Sport 2 Serbia</channel>
<channel site="tvarenasport.com" lang="sr" xmltv_id="ArenaSport3.rs" site_id="03" logo="https://www.tvarenasport.com/files/img/icons/chanel-03.png">Arena Sport 3 Serbia</channel>
<channel site="tvarenasport.com" lang="sr" xmltv_id="ArenaSport4.rs" site_id="04" logo="https://www.tvarenasport.com/files/img/icons/chanel-04.png">Arena Sport 4 Serbia</channel>
<channel site="tvarenasport.com" lang="sr" xmltv_id="ArenaSport5.rs" site_id="05" logo="https://www.tvarenasport.com/files/img/icons/chanel-05.png">Arena Sport 5 Serbia</channel>
<channel site="tvarenasport.com" lang="sr" xmltv_id="ArenaSport6.rs" site_id="06" logo="https://www.tvarenasport.com/files/img/icons/chanel-06.png">Arena Sport 6 Serbia</channel>
<channel site="tvarenasport.com" lang="sr" xmltv_id="ArenaSport7.rs" site_id="07" logo="https://www.tvarenasport.com/files/img/icons/chanel-07.png">Arena Sport 7 Serbia</channel>
<channel site="tvarenasport.com" lang="sr" xmltv_id="ArenaSport8.rs" site_id="08" logo="https://www.tvarenasport.com/files/img/icons/chanel-08.png">Arena Sport 8 Serbia</channel>
<channel site="tvarenasport.com" lang="sr" xmltv_id="ArenaSport9.rs" site_id="09" logo="https://www.tvarenasport.com/files/img/icons/chanel-09.png">Arena Sport 9 Serbia</channel>
<channel site="tvarenasport.com" lang="sr" xmltv_id="ArenaSport10.rs" site_id="10" logo="https://www.tvarenasport.com/files/img/icons/chanel-10.png">Arena Sport 10 Serbia</channel>
<channel site="tvarenasport.com" lang="sr" xmltv_id="ArenaSport1x2.rs" site_id="1x2" logo="https://www.tvarenasport.com/files/img/icons/chanel-1x2.png">Arena Sport 1x2 Serbia</channel>
<channel site="tvarenasport.com" lang="sr" xmltv_id="ArenaSportAdrenalin.rs" site_id="a-adrenalin" logo="https://www.tvarenasport.com/files/img/icons/chanel-a-adrenalin.png">Arena Sport Adrenalin Serbia</channel>
<channel site="tvarenasport.com" lang="sr" xmltv_id="ArenaSportTenis.rs" site_id="a-tenis" logo="https://www.tvarenasport.com/files/img/icons/chanel-a-tenis.png">Arena Sport Tenis Serbia</channel>
</channels>
<?xml version="1.0" encoding="UTF-8"?>
<channels>
<channel site="tvarenasport.com" lang="sr" xmltv_id="ArenaSport1Premium.rs" site_id="a1p" logo="https://www.tvarenasport.com/files/img/icons/chanel-a1p.png">Arena Sport 1 Premium Serbia</channel>
<channel site="tvarenasport.com" lang="sr" xmltv_id="ArenaSport2Premium.rs" site_id="a2p" logo="https://www.tvarenasport.com/files/img/icons/chanel-a2p.png">Arena Sport 2 Premium Serbia</channel>
<channel site="tvarenasport.com" lang="sr" xmltv_id="ArenaSport3Premium.rs" site_id="a3p" logo="https://www.tvarenasport.com/files/img/icons/chanel-a3p.png">Arena Sport 3 Premium Serbia</channel>
<channel site="tvarenasport.com" lang="sr" xmltv_id="ArenaSport4Premium.rs" site_id="a4p" logo="https://www.tvarenasport.com/files/img/icons/chanel-a4p.png">Arena Sport 4 Premium Serbia</channel>
<channel site="tvarenasport.com" lang="sr" xmltv_id="ArenaSport5Premium.rs" site_id="aa5p" logo="https://www.tvarenasport.com/files/img/icons/chanel-aa5p.png">Arena Sport 5 Premium Serbia</channel>
<channel site="tvarenasport.com" lang="sr" xmltv_id="ArenaSport1.rs" site_id="01" logo="https://www.tvarenasport.com/files/img/icons/chanel-01.png">Arena Sport 1 Serbia</channel>
<channel site="tvarenasport.com" lang="sr" xmltv_id="ArenaSport2.rs" site_id="02" logo="https://www.tvarenasport.com/files/img/icons/chanel-02.png">Arena Sport 2 Serbia</channel>
<channel site="tvarenasport.com" lang="sr" xmltv_id="ArenaSport3.rs" site_id="03" logo="https://www.tvarenasport.com/files/img/icons/chanel-03.png">Arena Sport 3 Serbia</channel>
<channel site="tvarenasport.com" lang="sr" xmltv_id="ArenaSport4.rs" site_id="04" logo="https://www.tvarenasport.com/files/img/icons/chanel-04.png">Arena Sport 4 Serbia</channel>
<channel site="tvarenasport.com" lang="sr" xmltv_id="ArenaSport5.rs" site_id="05" logo="https://www.tvarenasport.com/files/img/icons/chanel-05.png">Arena Sport 5 Serbia</channel>
<channel site="tvarenasport.com" lang="sr" xmltv_id="ArenaSport6.rs" site_id="06" logo="https://www.tvarenasport.com/files/img/icons/chanel-06.png">Arena Sport 6 Serbia</channel>
<channel site="tvarenasport.com" lang="sr" xmltv_id="ArenaSport7.rs" site_id="07" logo="https://www.tvarenasport.com/files/img/icons/chanel-07.png">Arena Sport 7 Serbia</channel>
<channel site="tvarenasport.com" lang="sr" xmltv_id="ArenaSport8.rs" site_id="08" logo="https://www.tvarenasport.com/files/img/icons/chanel-08.png">Arena Sport 8 Serbia</channel>
<channel site="tvarenasport.com" lang="sr" xmltv_id="ArenaSport9.rs" site_id="09" logo="https://www.tvarenasport.com/files/img/icons/chanel-09.png">Arena Sport 9 Serbia</channel>
<channel site="tvarenasport.com" lang="sr" xmltv_id="ArenaSport10.rs" site_id="10" logo="https://www.tvarenasport.com/files/img/icons/chanel-10.png">Arena Sport 10 Serbia</channel>
<channel site="tvarenasport.com" lang="sr" xmltv_id="ArenaSport1x2.rs" site_id="1x2" logo="https://www.tvarenasport.com/files/img/icons/chanel-1x2.png">Arena Sport 1x2 Serbia</channel>
<channel site="tvarenasport.com" lang="sr" xmltv_id="ArenaSportAdrenalin.rs" site_id="a-adrenalin" logo="https://www.tvarenasport.com/files/img/icons/chanel-a-adrenalin.png">Arena Sport Adrenalin Serbia</channel>
<channel site="tvarenasport.com" lang="sr" xmltv_id="ArenaSportTenis.rs" site_id="a-tenis" logo="https://www.tvarenasport.com/files/img/icons/chanel-a-tenis.png">Arena Sport Tenis Serbia</channel>
</channels>
+101 -101
View File
@@ -1,102 +1,102 @@
const cheerio = require('cheerio')
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)
const CHANNEL_LOGO_REGEX = /chanel-([\w-]+?)\.png/
const TIMEZONE = 'Europe/Belgrade'
module.exports = {
site: 'tvarenasport.com',
tz: TIMEZONE,
lang: 'sr',
days: 2,
request: {
cache: {
ttl: 24 * 60 * 60 * 1000 // 1 day
}
},
url: 'https://www.tvarenasport.com/tv-scheme',
parser({ content, channel, date }) {
const programs = []
const expectedDate = date.format('YYYY-MM-DD')
const $ = cheerio.load(content)
$('.tv-scheme-chanel').each((_, el) => {
const $ch = $(el)
const logo = $ch.find('.tv-scheme-chanel-header img').attr('src') || ''
const m = logo.match(CHANNEL_LOGO_REGEX)
if (!m || m[1] !== channel.site_id) return
const dates = $ch.find('.tv-scheme-days a').map((i, d) => {
const t = $(d).find('span:nth-child(3)').text().trim()
return dayjs(`${t}${date.year()}`, 'DD.MM.YYYY')
}).get()
const startIdx = dates.findIndex(d => d.format('YYYY-MM-DD') === expectedDate)
if (startIdx === -1) return
const sliders = $ch.find('.tv-scheme-new-slider-item')
const slider = sliders.eq(startIdx)
if (!slider.length) return
let entries = parseSchedules($, slider, dates[startIdx])
entries.forEach((e, i) => {
const nxt = entries[i + 1]
e.stop = nxt
? nxt.start
: dayjs.tz(`${expectedDate} 23:59`, 'YYYY-MM-DD HH:mm', TIMEZONE)
})
programs.push(...entries)
})
return programs
},
async channels() {
const data = await axios.get(this.url).then(r => r.data).catch(console.error)
if (!data) return []
const $ = cheerio.load(data)
return $('.tv-scheme-chanel-header img')
.map((_, img) => {
const src = $(img).attr('src') || ''
const m = src.match(CHANNEL_LOGO_REGEX)
if (!m) return null
const id = m[1]
const displayName = getDisplayName(id)
const xmltvId = displayName.replaceAll(' ', '').replace(/Serbia$/, '.rs')
const logourl = `https://www.${this.site}${src}`
return { site_id: id, lang: this.lang, xmltv_id: xmltvId, name: displayName, logo: logourl }
})
.get()
}
}
function getDisplayName(id) {
const template = name => `Arena Sport ${name} Serbia`
let m
if ((m = /^0*(\d+)$/.exec(id))) return template(m[1])
if ((m = /^a+(\d+)p$/.exec(id))) return template(`${m[1]} Premium`)
const formattedId = id.replace(/^a-/, '').replace(/^./, c => c.toUpperCase())
return template(formattedId)
}
function parseSchedules($, $slider, date) {
return $slider
.find('.slider-content')
.map((_, el) => parseSchedule($(el), date))
.get()
}
function parseSchedule($s, date) {
const time = $s.find('.slider-content-top span').text().trim()
const start = dayjs.tz(`${date.format('YYYY-MM-DD')} ${time}`, 'YYYY-MM-DD HH:mm', TIMEZONE)
const sport = $s.find('.slider-content-middle span').text().trim()
const titleText = $s.find('.slider-content-bottom p').text().trim()
const league = $s.find('.slider-content-bottom span')
.not('.live-title, .blob-text, .blob-border, .blob').first().text().trim()
const isLive = $s.find('.blob-text').text().trim().toLowerCase() === 'uživo'
const title = (isLive ? '(Uživo) ' : '') + (league ? `${league}: ${titleText}` : titleText)
return { title, category: sport, start }
const cheerio = require('cheerio')
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)
const CHANNEL_LOGO_REGEX = /chanel-([\w-]+?)\.png/
const TIMEZONE = 'Europe/Belgrade'
module.exports = {
site: 'tvarenasport.com',
tz: TIMEZONE,
lang: 'sr',
days: 2,
request: {
cache: {
ttl: 24 * 60 * 60 * 1000 // 1 day
}
},
url: 'https://www.tvarenasport.com/tv-scheme',
parser({ content, channel, date }) {
const programs = []
const expectedDate = date.format('YYYY-MM-DD')
const $ = cheerio.load(content)
$('.tv-scheme-chanel').each((_, el) => {
const $ch = $(el)
const logo = $ch.find('.tv-scheme-chanel-header img').attr('src') || ''
const m = logo.match(CHANNEL_LOGO_REGEX)
if (!m || m[1] !== channel.site_id) return
const dates = $ch.find('.tv-scheme-days a').map((i, d) => {
const t = $(d).find('span:nth-child(3)').text().trim()
return dayjs(`${t}${date.year()}`, 'DD.MM.YYYY')
}).get()
const startIdx = dates.findIndex(d => d.format('YYYY-MM-DD') === expectedDate)
if (startIdx === -1) return
const sliders = $ch.find('.tv-scheme-new-slider-item')
const slider = sliders.eq(startIdx)
if (!slider.length) return
let entries = parseSchedules($, slider, dates[startIdx])
entries.forEach((e, i) => {
const nxt = entries[i + 1]
e.stop = nxt
? nxt.start
: dayjs.tz(`${expectedDate} 23:59`, 'YYYY-MM-DD HH:mm', TIMEZONE)
})
programs.push(...entries)
})
return programs
},
async channels() {
const data = await axios.get(this.url).then(r => r.data).catch(console.error)
if (!data) return []
const $ = cheerio.load(data)
return $('.tv-scheme-chanel-header img')
.map((_, img) => {
const src = $(img).attr('src') || ''
const m = src.match(CHANNEL_LOGO_REGEX)
if (!m) return null
const id = m[1]
const displayName = getDisplayName(id)
const xmltvId = displayName.replaceAll(' ', '').replace(/Serbia$/, '.rs')
const logourl = `https://www.${this.site}${src}`
return { site_id: id, lang: this.lang, xmltv_id: xmltvId, name: displayName, logo: logourl }
})
.get()
}
}
function getDisplayName(id) {
const template = name => `Arena Sport ${name} Serbia`
let m
if ((m = /^0*(\d+)$/.exec(id))) return template(m[1])
if ((m = /^a+(\d+)p$/.exec(id))) return template(`${m[1]} Premium`)
const formattedId = id.replace(/^a-/, '').replace(/^./, c => c.toUpperCase())
return template(formattedId)
}
function parseSchedules($, $slider, date) {
return $slider
.find('.slider-content')
.map((_, el) => parseSchedule($(el), date))
.get()
}
function parseSchedule($s, date) {
const time = $s.find('.slider-content-top span').text().trim()
const start = dayjs.tz(`${date.format('YYYY-MM-DD')} ${time}`, 'YYYY-MM-DD HH:mm', TIMEZONE)
const sport = $s.find('.slider-content-middle span').text().trim()
const titleText = $s.find('.slider-content-bottom p').text().trim()
const league = $s.find('.slider-content-bottom span')
.not('.live-title, .blob-text, .blob-border, .blob').first().text().trim()
const isLive = $s.find('.blob-text').text().trim().toLowerCase() === 'uživo'
const title = (isLive ? '(Uživo) ' : '') + (league ? `${league}: ${titleText}` : titleText)
return { title, category: sport, start }
}
+50 -50
View File
@@ -1,50 +1,50 @@
const { parser, url } = require('./tvarenasport.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)
const date = dayjs.utc('2025-07-30', 'YYYY-MM-DD').startOf('d')
const channel = {
site_id: 'a1p',
xmltv_id: 'ArenaSport1Premium.rs'
}
it('can generate valid url', () => {
expect(url).toBe('https://www.tvarenasport.com/tv-scheme')
})
it('can parse response', () => {
const content = fs.readFileSync(path.join(__dirname, '__data__', 'content.html'))
const result = parser({ content, channel, date }).map(p => {
p.start = p.start.toJSON()
p.stop = p.stop.toJSON()
return p
})
expect(result.length).toBe(13)
expect(result[4]).toMatchObject({
start: '2025-07-30T08:00:00.000Z',
stop: '2025-07-30T09:00:00.000Z',
title: 'UEFA LIGA ŠAMPIONA: Liga Šampiona: Pregled sezone',
category: 'Fudbal'
})
expect(result[6]).toMatchObject({
start: '2025-07-30T11:00:00.000Z',
stop: '2025-07-30T13:00:00.000Z',
title: '(Uživo) PRIJATELJSKE UTAKMICE: K League - Newcastle Utd'
})
})
it('can handle empty guide', () => {
const result = parser({
date,
channel,
content: ''
})
expect(result).toMatchObject([])
})
const { parser, url } = require('./tvarenasport.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)
const date = dayjs.utc('2025-07-30', 'YYYY-MM-DD').startOf('d')
const channel = {
site_id: 'a1p',
xmltv_id: 'ArenaSport1Premium.rs'
}
it('can generate valid url', () => {
expect(url).toBe('https://www.tvarenasport.com/tv-scheme')
})
it('can parse response', () => {
const content = fs.readFileSync(path.join(__dirname, '__data__', 'content.html'))
const result = parser({ content, channel, date }).map(p => {
p.start = p.start.toJSON()
p.stop = p.stop.toJSON()
return p
})
expect(result.length).toBe(13)
expect(result[4]).toMatchObject({
start: '2025-07-30T08:00:00.000Z',
stop: '2025-07-30T09:00:00.000Z',
title: 'UEFA LIGA ŠAMPIONA: Liga Šampiona: Pregled sezone',
category: 'Fudbal'
})
expect(result[6]).toMatchObject({
start: '2025-07-30T11:00:00.000Z',
stop: '2025-07-30T13:00:00.000Z',
title: '(Uživo) PRIJATELJSKE UTAKMICE: K League - Newcastle Utd'
})
})
it('can handle empty guide', () => {
const result = parser({
date,
channel,
content: ''
})
expect(result).toMatchObject([])
})