Skip to content

Commit 581f5e0

Browse files
Merge pull request #2499 from tohenk/fix/tvarenasport.hr
Update tvarenasport.hr guide.
2 parents b4ca127 + 37505d3 commit 581f5e0

File tree

6 files changed

+5219
-83
lines changed

6 files changed

+5219
-83
lines changed

sites/tvarenasport.com/tvarenasport.com.config.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ dayjs.extend(utc)
99
dayjs.extend(timezone)
1010
dayjs.extend(customParseFormat)
1111

12-
const tz = 'Europe/Belgrade'
13-
1412
module.exports = {
1513
site: 'tvarenasport.com',
14+
tz: 'Europe/Belgrade',
15+
lang: 'sr',
1616
days: 2,
1717
request: {
1818
cache: {
@@ -40,7 +40,7 @@ module.exports = {
4040
.siblings('.tv-scheme-new-slider-wrapper')
4141
.find('.tv-scheme-new-slider-item').toArray()
4242
.forEach((el, i) => {
43-
programs.push(...parseSchedules($(el), dates[i]))
43+
programs.push(...parseSchedules($(el), dates[i], module.exports.tz))
4444
})
4545
programs.forEach((s, i) => {
4646
if (i < programs.length - 2) {
@@ -57,7 +57,7 @@ module.exports = {
5757
async channels() {
5858
const channels = []
5959
const data = await axios
60-
.get('https://www.tvarenasport.com/tv-scheme')
60+
.get(this.url)
6161
.then(r => r.data)
6262
.catch(console.error)
6363

@@ -84,7 +84,7 @@ module.exports = {
8484
const [, id] = $(item).attr('src').match(/chanel-([a-z0-9]+)\.png/) || [null, null]
8585
if (id) {
8686
channels.push({
87-
lang: 'sr',
87+
lang: this.lang,
8888
site_id: id,
8989
name: names(id)
9090
})
@@ -96,18 +96,18 @@ module.exports = {
9696
}
9797
}
9898

99-
function parseSchedules($s, date) {
99+
function parseSchedules($s, date, tz) {
100100
const schedules = []
101101
const $ = $s._make
102102
$s.find('.slider-content').toArray()
103103
.forEach(el => {
104-
schedules.push(parseSchedule($(el), date))
104+
schedules.push(parseSchedule($(el), date, tz))
105105
})
106106

107107
return schedules
108108
}
109109

110-
function parseSchedule($s, date) {
110+
function parseSchedule($s, date, tz) {
111111
const time = $s.find('.slider-content-top span').text()
112112
const start = dayjs.tz(`${date.format('YYYY-MM-DD')} ${time}`, 'YYYY-MM-DD HH:mm', tz)
113113
const category = $s.find('.slider-content-middle span').text()

sites/tvarenasport.com/tvarenasport.com.test.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ const channel = {
1414
xmltv_id: 'ArenaSport1Premium.rs'
1515
}
1616

17+
it('can generate valid url', () => {
18+
expect(url).toBe('https://www.tvarenasport.com/tv-scheme')
19+
})
20+
1721
it('can parse response', () => {
1822
const content = fs.readFileSync(path.join(__dirname, '__data__', 'content.html'))
1923
const result = parser({ channel, date, content }).map(p => {

0 commit comments

Comments
 (0)