Merge branch 'snrt.ma' of https://github.com/fraudiay79/epg into pr/2534

This commit is contained in:
freearhey 2024-12-22 23:51:56 +03:00
commit 73a80fbb3b
24 changed files with 3829 additions and 635 deletions

File diff suppressed because it is too large Load diff

View file

@ -1,21 +1,21 @@
# snrt.ma
https://www.snrt.ma/ar/node/1208
### Download the guide
```sh
npm run grab --- --site=snrt.ma
```
### Update channel list
```sh
npm run channels:parse --- --config=./sites/snrt.ma/snrt.ma.config.js --output=./sites/snrt.ma/snrt.ma.channels.xml
```
### Test
```sh
npm test --- snrt.ma
# snrt.ma
https://www.snrt.ma/ar/node/1208
### Download the guide
```sh
npm run grab --- --site=snrt.ma
```
### Update channel list
```sh
npm run channels:parse --- --config=./sites/snrt.ma/snrt.ma.config.js --output=./sites/snrt.ma/snrt.ma.channels.xml
```
### Test
```sh
npm test --- snrt.ma
```

View file

@ -1,44 +1,45 @@
const { parser, url } = require('./snrt.ma.config.js')
const cheerio = require('cheerio')
const { DateTime } = require('luxon')
const dayjs = require('dayjs')
const utc = require('dayjs/plugin/utc')
const timezone = require('dayjs/plugin/timezone')
const fs = require('fs')
const path = require('path')
dayjs.extend(utc)
dayjs.extend(timezone)
dayjs.extend(customParseFormat)
const date = dayjs.utc('2024-12-19', 'YYYY-MM-DD').startOf('d')
const channel = { site_id: '1208', xmltv_id: 'AlAoula.ma', lang: 'ar' }
it('can generate valid url', () => {
expect(url({ channel })).toBe('https://www.snrt.ma/ar/node/1208')
})
it('can parse response', () => {
const content = fs.readFileSync(path.resolve(__dirname, '__data__/content.html'))
const results = parser({ date, content }).map(p => {
p.start = p.start.toJSON()
p.stop = p.stop.toJSON()
return p
})
expect(results).toMatchObject({
start: '2024-12-19T07:00:00.000Z',
stop: '2024-12-19T07:10:00.000Z',
title: 'ﺍﻟﺴﻼﻡ ﺍﻟﻮﻃﻨﻲ + ﺍﻟﻘﺮﺁﻥ ﺍﻟﻜﺮﻳﻢ',
category: 'القرآن الكريم'
})
})
it('can handle empty guide', () => {
const result = parser({
date,
channel: channel,
content: '<!DOCTYPE html><html lang="ar" dir="rtl"><head></head><body></body></html>'
})
expect(result).toMatchObject([])
const { parser, url } = require('./snrt.ma.config.js')
const cheerio = require('cheerio')
const { DateTime } = require('luxon')
const dayjs = require('dayjs')
const utc = require('dayjs/plugin/utc')
const timezone = require('dayjs/plugin/timezone')
const fs = require('fs')
const path = require('path')
dayjs.extend(utc)
dayjs.extend(timezone)
const date = dayjs.utc('2024-12-19', 'YYYY-MM-DD').startOf('d')
const channel = { site_id: '1208', xmltv_id: 'AlAoula.ma', lang: 'ar' }
it('can generate valid url', () => {
expect(url({ channel })).toBe('https://www.snrt.ma/ar/node/1208')
})
it('can parse response', () => {
const content = fs.readFileSync(path.resolve(__dirname, '__data__/content.html'))
const results = parser({ date, content }).map(p => {
p.start = p.start.toJSON()
p.stop = p.stop.toJSON()
return p
})
expect(results[0]).toMatchObject({
"category": "القرآن الكريم",
"description": "",
"start": "2024-12-19T06:00:00.000Z",
"stop": "2024-12-19T06:10:00.000Z",
"stop": "2024-12-19T06:30:00.000Z",
"title": "ﺍﻟﺴﻼﻡ ﺍﻟﻮﻃﻨﻲ + ﺍﻟﻘﺮﺁﻥ ﺍﻟﻜﺮﻳﻢ"
})
})
it('can handle empty guide', () => {
const result = parser({
date,
channel: channel,
content: '<!DOCTYPE html><html lang="ar" dir="rtl"><head></head><body></body></html>'
})
expect(result).toMatchObject([])
})