mirror of
https://github.com/iptv-org/epg
synced 2026-05-01 23:17:00 -04:00
Replace LF line endings with CRLF
This commit is contained in:
@@ -1,37 +1,37 @@
|
||||
# sat.tv
|
||||
|
||||
https://sat.tv/tv-channels
|
||||
|
||||
### Download the guide
|
||||
|
||||
Arabic:
|
||||
|
||||
```sh
|
||||
npm run grab --- --site=sat.tv --lang=ar
|
||||
```
|
||||
|
||||
English:
|
||||
|
||||
```sh
|
||||
npm run grab --- --site=sat.tv --lang=en
|
||||
```
|
||||
|
||||
### Update channel list
|
||||
|
||||
Arabic:
|
||||
|
||||
```sh
|
||||
npm run channels:parse --- --config=./sites/sat.tv/sat.tv.config.js --output=./sites/sat.tv/sat.tv_ar.channels.xml --set=lang:ar
|
||||
```
|
||||
|
||||
English:
|
||||
|
||||
```sh
|
||||
npm run channels:parse --- --config=./sites/sat.tv/sat.tv.config.js --output=./sites/sat.tv/sat.tv_en.channels.xml --set=lang:en
|
||||
```
|
||||
|
||||
### Test
|
||||
|
||||
```sh
|
||||
npm test --- sat.tv
|
||||
```
|
||||
# sat.tv
|
||||
|
||||
https://sat.tv/tv-channels
|
||||
|
||||
### Download the guide
|
||||
|
||||
Arabic:
|
||||
|
||||
```sh
|
||||
npm run grab --- --site=sat.tv --lang=ar
|
||||
```
|
||||
|
||||
English:
|
||||
|
||||
```sh
|
||||
npm run grab --- --site=sat.tv --lang=en
|
||||
```
|
||||
|
||||
### Update channel list
|
||||
|
||||
Arabic:
|
||||
|
||||
```sh
|
||||
npm run channels:parse --- --config=./sites/sat.tv/sat.tv.config.js --output=./sites/sat.tv/sat.tv_ar.channels.xml --set=lang:ar
|
||||
```
|
||||
|
||||
English:
|
||||
|
||||
```sh
|
||||
npm run channels:parse --- --config=./sites/sat.tv/sat.tv.config.js --output=./sites/sat.tv/sat.tv_en.channels.xml --set=lang:en
|
||||
```
|
||||
|
||||
### Test
|
||||
|
||||
```sh
|
||||
npm test --- sat.tv
|
||||
```
|
||||
|
||||
@@ -1,173 +1,173 @@
|
||||
const axios = require('axios')
|
||||
const dayjs = require('dayjs')
|
||||
const cheerio = require('cheerio')
|
||||
const utc = require('dayjs/plugin/utc')
|
||||
const customParseFormat = require('dayjs/plugin/customParseFormat')
|
||||
|
||||
dayjs.extend(utc)
|
||||
dayjs.extend(customParseFormat)
|
||||
|
||||
const API_ENDPOINT = 'https://www.sat.tv/wp-content/themes/twentytwenty-child/ajax_chaines.php'
|
||||
|
||||
module.exports = {
|
||||
site: 'sat.tv',
|
||||
days: 2,
|
||||
url: API_ENDPOINT,
|
||||
request: {
|
||||
method: 'POST',
|
||||
headers({ channel }) {
|
||||
return {
|
||||
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
|
||||
Cookie: `pll_language=${channel.lang}`
|
||||
}
|
||||
},
|
||||
data({ channel, date }) {
|
||||
const [satSatellite, satLineup] = channel.site_id.split('#')
|
||||
const params = new URLSearchParams()
|
||||
params.append('dateFiltre', date.format('YYYY-MM-DD'))
|
||||
params.append('hoursFiltre', '0')
|
||||
params.append('satLineup', satLineup)
|
||||
params.append('satSatellite', satSatellite)
|
||||
params.append('userDateTime', date.valueOf())
|
||||
params.append('userTimezone', 'Europe/London')
|
||||
|
||||
return params
|
||||
},
|
||||
cache: {
|
||||
ttl: 60 * 60 * 1000 // 1h
|
||||
}
|
||||
},
|
||||
parser: function ({ content, date, channel }) {
|
||||
let programs = []
|
||||
const items = parseItems(content, channel)
|
||||
items.forEach(item => {
|
||||
let $item = cheerio.load(item)
|
||||
let start = parseStart($item, date)
|
||||
let duration = parseDuration($item)
|
||||
let stop = start.add(duration, 'm')
|
||||
|
||||
programs.push({
|
||||
title: parseTitle($item),
|
||||
description: parseDescription($item),
|
||||
image: parseImage($item),
|
||||
start,
|
||||
stop
|
||||
})
|
||||
})
|
||||
|
||||
return programs
|
||||
},
|
||||
async channels({ lang }) {
|
||||
const satellites = [
|
||||
{ satellite: 2, lineup: 55 },
|
||||
{ satellite: 2, lineup: 58 },
|
||||
{ satellite: 2, lineup: 53 },
|
||||
{ satellite: 2, lineup: 57 },
|
||||
{ satellite: 2, lineup: 54 },
|
||||
{ satellite: 2, lineup: 56 },
|
||||
{ satellite: 1, lineup: 48 },
|
||||
{ satellite: 1, lineup: 44 },
|
||||
{ satellite: 1, lineup: 42 },
|
||||
{ satellite: 1, lineup: 39 },
|
||||
{ satellite: 1, lineup: 37 },
|
||||
{ satellite: 1, lineup: 38 },
|
||||
{ satellite: 1, lineup: 68 },
|
||||
{ satellite: 1, lineup: 47 },
|
||||
{ satellite: 1, lineup: 41 },
|
||||
{ satellite: 1, lineup: 49 },
|
||||
{ satellite: 1, lineup: 46 },
|
||||
{ satellite: 1, lineup: 35 },
|
||||
{ satellite: 1, lineup: 43 },
|
||||
{ satellite: 1, lineup: 45 },
|
||||
{ satellite: 1, lineup: 50 },
|
||||
{ satellite: 1, lineup: 71 },
|
||||
{ satellite: 1, lineup: 40 },
|
||||
{ satellite: 1, lineup: 72 },
|
||||
{ satellite: 1, lineup: 33 },
|
||||
{ satellite: 8, lineup: 62 },
|
||||
{ satellite: 8, lineup: 63 },
|
||||
{ satellite: 8, lineup: 64 },
|
||||
{ satellite: 8, lineup: 65 },
|
||||
{ satellite: 8, lineup: 66 },
|
||||
{ satellite: 8, lineup: 67 }
|
||||
]
|
||||
|
||||
let channels = []
|
||||
for (let sat of satellites) {
|
||||
const params = new URLSearchParams()
|
||||
params.append('dateFiltre', dayjs().format('YYYY-MM-DD'))
|
||||
params.append('hoursFiltre', '0')
|
||||
params.append('satLineup', sat.lineup)
|
||||
params.append('satSatellite', sat.satellite)
|
||||
params.append('userDateTime', dayjs().valueOf())
|
||||
params.append('userTimezone', 'Europe/London')
|
||||
const data = await axios
|
||||
.post(API_ENDPOINT, params, {
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
|
||||
Cookie: `pll_language=${lang}`
|
||||
}
|
||||
})
|
||||
.then(r => r.data)
|
||||
.catch(console.log)
|
||||
|
||||
const $ = cheerio.load(data)
|
||||
$('.main-container-channels-events > .container-channel-events').each((i, el) => {
|
||||
const name = $(el).find('.channel-title').text().trim()
|
||||
const channelId = name.replace(/\s&\s/gi, ' & ')
|
||||
|
||||
if (!name) return
|
||||
|
||||
channels.push({
|
||||
lang,
|
||||
site_id: `${sat.satellite}#${sat.lineup}#${channelId}`,
|
||||
name
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
return channels
|
||||
}
|
||||
}
|
||||
|
||||
function parseImage($item) {
|
||||
const src = $item('.event-logo img:not(.no-img)').attr('src')
|
||||
|
||||
return src ? `https://sat.tv${src}` : null
|
||||
}
|
||||
|
||||
function parseTitle($item) {
|
||||
return $item('.event-data-title').text()
|
||||
}
|
||||
|
||||
function parseDescription($item) {
|
||||
return $item('.event-data-desc').text()
|
||||
}
|
||||
|
||||
function parseStart($item, date) {
|
||||
let eventDataDate = $item('.event-data-date').text().trim()
|
||||
let [, time] = eventDataDate.match(/(\d{2}:\d{2})/) || [null, null]
|
||||
if (!time) return null
|
||||
|
||||
return dayjs.utc(`${date.format('YYYY-MM-DD')} ${time}`, 'YYYY-MM-DD HH:mm')
|
||||
}
|
||||
|
||||
function parseDuration($item) {
|
||||
let eventDataInfo = $item('.event-data-info').text().trim()
|
||||
let [, h, m] = eventDataInfo.match(/(\d{2})h(\d{2})/) || [null, 0, 0]
|
||||
|
||||
return parseInt(h) * 60 + parseInt(m)
|
||||
}
|
||||
|
||||
function parseItems(content, channel) {
|
||||
const [, , site_id] = channel.site_id.split('#')
|
||||
const $ = cheerio.load(content)
|
||||
const channelData = $('.main-container-channels-events > .container-channel-events')
|
||||
.filter((index, el) => {
|
||||
return $(el).find('.channel-title').text().trim() === site_id
|
||||
})
|
||||
.first()
|
||||
if (!channelData) return []
|
||||
|
||||
return $(channelData).find('.container-event').toArray()
|
||||
}
|
||||
const axios = require('axios')
|
||||
const dayjs = require('dayjs')
|
||||
const cheerio = require('cheerio')
|
||||
const utc = require('dayjs/plugin/utc')
|
||||
const customParseFormat = require('dayjs/plugin/customParseFormat')
|
||||
|
||||
dayjs.extend(utc)
|
||||
dayjs.extend(customParseFormat)
|
||||
|
||||
const API_ENDPOINT = 'https://www.sat.tv/wp-content/themes/twentytwenty-child/ajax_chaines.php'
|
||||
|
||||
module.exports = {
|
||||
site: 'sat.tv',
|
||||
days: 2,
|
||||
url: API_ENDPOINT,
|
||||
request: {
|
||||
method: 'POST',
|
||||
headers({ channel }) {
|
||||
return {
|
||||
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
|
||||
Cookie: `pll_language=${channel.lang}`
|
||||
}
|
||||
},
|
||||
data({ channel, date }) {
|
||||
const [satSatellite, satLineup] = channel.site_id.split('#')
|
||||
const params = new URLSearchParams()
|
||||
params.append('dateFiltre', date.format('YYYY-MM-DD'))
|
||||
params.append('hoursFiltre', '0')
|
||||
params.append('satLineup', satLineup)
|
||||
params.append('satSatellite', satSatellite)
|
||||
params.append('userDateTime', date.valueOf())
|
||||
params.append('userTimezone', 'Europe/London')
|
||||
|
||||
return params
|
||||
},
|
||||
cache: {
|
||||
ttl: 60 * 60 * 1000 // 1h
|
||||
}
|
||||
},
|
||||
parser: function ({ content, date, channel }) {
|
||||
let programs = []
|
||||
const items = parseItems(content, channel)
|
||||
items.forEach(item => {
|
||||
let $item = cheerio.load(item)
|
||||
let start = parseStart($item, date)
|
||||
let duration = parseDuration($item)
|
||||
let stop = start.add(duration, 'm')
|
||||
|
||||
programs.push({
|
||||
title: parseTitle($item),
|
||||
description: parseDescription($item),
|
||||
image: parseImage($item),
|
||||
start,
|
||||
stop
|
||||
})
|
||||
})
|
||||
|
||||
return programs
|
||||
},
|
||||
async channels({ lang }) {
|
||||
const satellites = [
|
||||
{ satellite: 2, lineup: 55 },
|
||||
{ satellite: 2, lineup: 58 },
|
||||
{ satellite: 2, lineup: 53 },
|
||||
{ satellite: 2, lineup: 57 },
|
||||
{ satellite: 2, lineup: 54 },
|
||||
{ satellite: 2, lineup: 56 },
|
||||
{ satellite: 1, lineup: 48 },
|
||||
{ satellite: 1, lineup: 44 },
|
||||
{ satellite: 1, lineup: 42 },
|
||||
{ satellite: 1, lineup: 39 },
|
||||
{ satellite: 1, lineup: 37 },
|
||||
{ satellite: 1, lineup: 38 },
|
||||
{ satellite: 1, lineup: 68 },
|
||||
{ satellite: 1, lineup: 47 },
|
||||
{ satellite: 1, lineup: 41 },
|
||||
{ satellite: 1, lineup: 49 },
|
||||
{ satellite: 1, lineup: 46 },
|
||||
{ satellite: 1, lineup: 35 },
|
||||
{ satellite: 1, lineup: 43 },
|
||||
{ satellite: 1, lineup: 45 },
|
||||
{ satellite: 1, lineup: 50 },
|
||||
{ satellite: 1, lineup: 71 },
|
||||
{ satellite: 1, lineup: 40 },
|
||||
{ satellite: 1, lineup: 72 },
|
||||
{ satellite: 1, lineup: 33 },
|
||||
{ satellite: 8, lineup: 62 },
|
||||
{ satellite: 8, lineup: 63 },
|
||||
{ satellite: 8, lineup: 64 },
|
||||
{ satellite: 8, lineup: 65 },
|
||||
{ satellite: 8, lineup: 66 },
|
||||
{ satellite: 8, lineup: 67 }
|
||||
]
|
||||
|
||||
let channels = []
|
||||
for (let sat of satellites) {
|
||||
const params = new URLSearchParams()
|
||||
params.append('dateFiltre', dayjs().format('YYYY-MM-DD'))
|
||||
params.append('hoursFiltre', '0')
|
||||
params.append('satLineup', sat.lineup)
|
||||
params.append('satSatellite', sat.satellite)
|
||||
params.append('userDateTime', dayjs().valueOf())
|
||||
params.append('userTimezone', 'Europe/London')
|
||||
const data = await axios
|
||||
.post(API_ENDPOINT, params, {
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
|
||||
Cookie: `pll_language=${lang}`
|
||||
}
|
||||
})
|
||||
.then(r => r.data)
|
||||
.catch(console.log)
|
||||
|
||||
const $ = cheerio.load(data)
|
||||
$('.main-container-channels-events > .container-channel-events').each((i, el) => {
|
||||
const name = $(el).find('.channel-title').text().trim()
|
||||
const channelId = name.replace(/\s&\s/gi, ' & ')
|
||||
|
||||
if (!name) return
|
||||
|
||||
channels.push({
|
||||
lang,
|
||||
site_id: `${sat.satellite}#${sat.lineup}#${channelId}`,
|
||||
name
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
return channels
|
||||
}
|
||||
}
|
||||
|
||||
function parseImage($item) {
|
||||
const src = $item('.event-logo img:not(.no-img)').attr('src')
|
||||
|
||||
return src ? `https://sat.tv${src}` : null
|
||||
}
|
||||
|
||||
function parseTitle($item) {
|
||||
return $item('.event-data-title').text()
|
||||
}
|
||||
|
||||
function parseDescription($item) {
|
||||
return $item('.event-data-desc').text()
|
||||
}
|
||||
|
||||
function parseStart($item, date) {
|
||||
let eventDataDate = $item('.event-data-date').text().trim()
|
||||
let [, time] = eventDataDate.match(/(\d{2}:\d{2})/) || [null, null]
|
||||
if (!time) return null
|
||||
|
||||
return dayjs.utc(`${date.format('YYYY-MM-DD')} ${time}`, 'YYYY-MM-DD HH:mm')
|
||||
}
|
||||
|
||||
function parseDuration($item) {
|
||||
let eventDataInfo = $item('.event-data-info').text().trim()
|
||||
let [, h, m] = eventDataInfo.match(/(\d{2})h(\d{2})/) || [null, 0, 0]
|
||||
|
||||
return parseInt(h) * 60 + parseInt(m)
|
||||
}
|
||||
|
||||
function parseItems(content, channel) {
|
||||
const [, , site_id] = channel.site_id.split('#')
|
||||
const $ = cheerio.load(content)
|
||||
const channelData = $('.main-container-channels-events > .container-channel-events')
|
||||
.filter((index, el) => {
|
||||
return $(el).find('.channel-title').text().trim() === site_id
|
||||
})
|
||||
.first()
|
||||
if (!channelData) return []
|
||||
|
||||
return $(channelData).find('.container-event').toArray()
|
||||
}
|
||||
|
||||
@@ -1,112 +1,112 @@
|
||||
const { parser, url, request } = require('./sat.tv.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('2023-06-26', 'YYYY-MM-DD').startOf('d')
|
||||
const channel = {
|
||||
site_id: '1#38#السعودية',
|
||||
xmltv_id: 'AlSaudiya.sa',
|
||||
lang: 'ar'
|
||||
}
|
||||
|
||||
it('can generate valid url', () => {
|
||||
expect(url).toBe('https://www.sat.tv/wp-content/themes/twentytwenty-child/ajax_chaines.php')
|
||||
})
|
||||
|
||||
it('can generate valid request method', () => {
|
||||
expect(request.method).toBe('POST')
|
||||
})
|
||||
|
||||
it('can generate valid request headers', () => {
|
||||
expect(request.headers({ channel })).toMatchObject({
|
||||
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
|
||||
Cookie: 'pll_language=ar'
|
||||
})
|
||||
})
|
||||
|
||||
it('can generate valid request data', () => {
|
||||
const data = request.data({ channel, date })
|
||||
expect(data.get('dateFiltre')).toBe('2023-06-26')
|
||||
expect(data.get('hoursFiltre')).toBe('0')
|
||||
expect(data.get('satLineup')).toBe('38')
|
||||
expect(data.get('satSatellite')).toBe('1')
|
||||
expect(data.get('userDateTime')).toBe('1687737600000')
|
||||
expect(data.get('userTimezone')).toBe('Europe/London')
|
||||
})
|
||||
|
||||
it('can parse response', () => {
|
||||
const content = fs.readFileSync(path.resolve(__dirname, '__data__/content_ar.html'))
|
||||
const results = parser({ content, date, channel }).map(p => {
|
||||
p.start = p.start.toJSON()
|
||||
p.stop = p.stop.toJSON()
|
||||
return p
|
||||
})
|
||||
|
||||
expect(results.length).toBe(35)
|
||||
expect(results[0]).toMatchObject({
|
||||
start: '2023-06-26T06:30:00.000Z',
|
||||
stop: '2023-06-26T07:00:00.000Z',
|
||||
title: 'تعظيم البلد الحرام',
|
||||
description: `الناس, دين, ثقافة
|
||||
يلقي صانع الفيلم الضوء على مشروع تعظيم البلد الحرام في مكة من العائلة الملكية في المملكة العربية السعودية، والذي يهدف لإبراز حرمته لدى المسلمين حول العالم.`,
|
||||
image: null
|
||||
})
|
||||
|
||||
expect(results[34]).toMatchObject({
|
||||
start: '2023-06-26T22:30:00.000Z',
|
||||
stop: '2023-06-27T01:00:00.000Z',
|
||||
title: 'الأخبار',
|
||||
description: `نشرة
|
||||
.يطرح أهم القضايا والأحداث على الساحة السعودية والعالمية`,
|
||||
image:
|
||||
'https://sat.tv/wp-content/themes/twentytwenty-child/data_lineups/nilesat/images3/epg-3077892.jpg'
|
||||
})
|
||||
})
|
||||
|
||||
it('can parse response in english', () => {
|
||||
const channel = {
|
||||
site_id: '1#38#Saudi HD',
|
||||
xmltv_id: 'AlSaudiya.sa',
|
||||
lang: 'en'
|
||||
}
|
||||
const content = fs.readFileSync(path.resolve(__dirname, '__data__/content_en.html'))
|
||||
const results = parser({ content, date, channel }).map(p => {
|
||||
p.start = p.start.toJSON()
|
||||
p.stop = p.stop.toJSON()
|
||||
return p
|
||||
})
|
||||
|
||||
expect(results.length).toBe(32)
|
||||
expect(results[0]).toMatchObject({
|
||||
start: '2023-06-26T09:00:00.000Z',
|
||||
stop: '2023-06-26T10:00:00.000Z',
|
||||
title: 'News',
|
||||
description: `Newscast
|
||||
The most important issues and events on the Saudi and the world.`,
|
||||
image:
|
||||
'https://sat.tv/wp-content/themes/twentytwenty-child/data_lineups/nilesat/images3/epg-3077892.jpg'
|
||||
})
|
||||
|
||||
expect(results[31]).toMatchObject({
|
||||
start: '2023-06-26T23:15:00.000Z',
|
||||
stop: '2023-06-27T00:00:00.000Z',
|
||||
title: "Bride's Father",
|
||||
description: `Romance, Drama, Family
|
||||
2022
|
||||
Abdelhamid's family struggles to deal with the challenges of life that keep flowing one by one. they manage to stay strong-armed with their love and trust for each other.
|
||||
Sayed Ragab, Sawsan Badr, Medhat Saleh, Nermine Al Feqy, Mohamed Adel, Khaled Kamal, Rania Farid, Hani Kamal, Hani Kamal`,
|
||||
image:
|
||||
'https://sat.tv/wp-content/themes/twentytwenty-child/data_lineups/nilesat/images3/epg-3157177.jpg'
|
||||
})
|
||||
})
|
||||
|
||||
it('can handle empty guide', () => {
|
||||
const content = fs.readFileSync(path.resolve(__dirname, '__data__/no_content.html'))
|
||||
const result = parser({ content, date, channel })
|
||||
expect(result).toMatchObject([])
|
||||
})
|
||||
const { parser, url, request } = require('./sat.tv.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('2023-06-26', 'YYYY-MM-DD').startOf('d')
|
||||
const channel = {
|
||||
site_id: '1#38#السعودية',
|
||||
xmltv_id: 'AlSaudiya.sa',
|
||||
lang: 'ar'
|
||||
}
|
||||
|
||||
it('can generate valid url', () => {
|
||||
expect(url).toBe('https://www.sat.tv/wp-content/themes/twentytwenty-child/ajax_chaines.php')
|
||||
})
|
||||
|
||||
it('can generate valid request method', () => {
|
||||
expect(request.method).toBe('POST')
|
||||
})
|
||||
|
||||
it('can generate valid request headers', () => {
|
||||
expect(request.headers({ channel })).toMatchObject({
|
||||
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
|
||||
Cookie: 'pll_language=ar'
|
||||
})
|
||||
})
|
||||
|
||||
it('can generate valid request data', () => {
|
||||
const data = request.data({ channel, date })
|
||||
expect(data.get('dateFiltre')).toBe('2023-06-26')
|
||||
expect(data.get('hoursFiltre')).toBe('0')
|
||||
expect(data.get('satLineup')).toBe('38')
|
||||
expect(data.get('satSatellite')).toBe('1')
|
||||
expect(data.get('userDateTime')).toBe('1687737600000')
|
||||
expect(data.get('userTimezone')).toBe('Europe/London')
|
||||
})
|
||||
|
||||
it('can parse response', () => {
|
||||
const content = fs.readFileSync(path.resolve(__dirname, '__data__/content_ar.html'))
|
||||
const results = parser({ content, date, channel }).map(p => {
|
||||
p.start = p.start.toJSON()
|
||||
p.stop = p.stop.toJSON()
|
||||
return p
|
||||
})
|
||||
|
||||
expect(results.length).toBe(35)
|
||||
expect(results[0]).toMatchObject({
|
||||
start: '2023-06-26T06:30:00.000Z',
|
||||
stop: '2023-06-26T07:00:00.000Z',
|
||||
title: 'تعظيم البلد الحرام',
|
||||
description: `الناس, دين, ثقافة
|
||||
يلقي صانع الفيلم الضوء على مشروع تعظيم البلد الحرام في مكة من العائلة الملكية في المملكة العربية السعودية، والذي يهدف لإبراز حرمته لدى المسلمين حول العالم.`,
|
||||
image: null
|
||||
})
|
||||
|
||||
expect(results[34]).toMatchObject({
|
||||
start: '2023-06-26T22:30:00.000Z',
|
||||
stop: '2023-06-27T01:00:00.000Z',
|
||||
title: 'الأخبار',
|
||||
description: `نشرة
|
||||
.يطرح أهم القضايا والأحداث على الساحة السعودية والعالمية`,
|
||||
image:
|
||||
'https://sat.tv/wp-content/themes/twentytwenty-child/data_lineups/nilesat/images3/epg-3077892.jpg'
|
||||
})
|
||||
})
|
||||
|
||||
it('can parse response in english', () => {
|
||||
const channel = {
|
||||
site_id: '1#38#Saudi HD',
|
||||
xmltv_id: 'AlSaudiya.sa',
|
||||
lang: 'en'
|
||||
}
|
||||
const content = fs.readFileSync(path.resolve(__dirname, '__data__/content_en.html'))
|
||||
const results = parser({ content, date, channel }).map(p => {
|
||||
p.start = p.start.toJSON()
|
||||
p.stop = p.stop.toJSON()
|
||||
return p
|
||||
})
|
||||
|
||||
expect(results.length).toBe(32)
|
||||
expect(results[0]).toMatchObject({
|
||||
start: '2023-06-26T09:00:00.000Z',
|
||||
stop: '2023-06-26T10:00:00.000Z',
|
||||
title: 'News',
|
||||
description: `Newscast
|
||||
The most important issues and events on the Saudi and the world.`,
|
||||
image:
|
||||
'https://sat.tv/wp-content/themes/twentytwenty-child/data_lineups/nilesat/images3/epg-3077892.jpg'
|
||||
})
|
||||
|
||||
expect(results[31]).toMatchObject({
|
||||
start: '2023-06-26T23:15:00.000Z',
|
||||
stop: '2023-06-27T00:00:00.000Z',
|
||||
title: "Bride's Father",
|
||||
description: `Romance, Drama, Family
|
||||
2022
|
||||
Abdelhamid's family struggles to deal with the challenges of life that keep flowing one by one. they manage to stay strong-armed with their love and trust for each other.
|
||||
Sayed Ragab, Sawsan Badr, Medhat Saleh, Nermine Al Feqy, Mohamed Adel, Khaled Kamal, Rania Farid, Hani Kamal, Hani Kamal`,
|
||||
image:
|
||||
'https://sat.tv/wp-content/themes/twentytwenty-child/data_lineups/nilesat/images3/epg-3157177.jpg'
|
||||
})
|
||||
})
|
||||
|
||||
it('can handle empty guide', () => {
|
||||
const content = fs.readFileSync(path.resolve(__dirname, '__data__/no_content.html'))
|
||||
const result = parser({ content, date, channel })
|
||||
expect(result).toMatchObject([])
|
||||
})
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user