mirror of
https://github.com/iptv-org/epg
synced 2025-12-16 02:16:40 -05:00
Replace LF line endings with CRLF
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<channels>
|
||||
<!--
|
||||
`site_id` is not relevant for this configuration as nhl.com only has a guide for one channel.
|
||||
nonetheless I elected to use "network" here because:
|
||||
1) a blank value causes the record to be skipped
|
||||
2) "network" is a keyword in the API endpoint
|
||||
-->
|
||||
<channel site="nhl.com" lang="en" xmltv_id="NHLNetwork.us" site_id="network">NHL Network</channel>
|
||||
</channels>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<channels>
|
||||
<!--
|
||||
`site_id` is not relevant for this configuration as nhl.com only has a guide for one channel.
|
||||
nonetheless I elected to use "network" here because:
|
||||
1) a blank value causes the record to be skipped
|
||||
2) "network" is a keyword in the API endpoint
|
||||
-->
|
||||
<channel site="nhl.com" lang="en" xmltv_id="NHLNetwork.us" site_id="network">NHL Network</channel>
|
||||
</channels>
|
||||
|
||||
@@ -1,46 +1,46 @@
|
||||
const dayjs = require('dayjs')
|
||||
|
||||
module.exports = {
|
||||
site: 'nhl.com',
|
||||
// I'm not sure what `endDate` represents but they only return 1 day of
|
||||
// results, with `endTime`s ocassionally in the following day.
|
||||
days: 1,
|
||||
url: ({ date }) =>
|
||||
`https://api-web.nhle.com/v1/network/tv-schedule/${date.toJSON().split('T')[0]}`,
|
||||
parser({ content }) {
|
||||
const programs = []
|
||||
const items = parseItems(content)
|
||||
for (const item of items) {
|
||||
programs.push({
|
||||
title: item.title,
|
||||
description: item.description === item.title ? undefined : item.description,
|
||||
category: 'Sports',
|
||||
// image: parseImage(item),
|
||||
start: parseStart(item),
|
||||
stop: parseStop(item)
|
||||
})
|
||||
}
|
||||
|
||||
return programs
|
||||
}
|
||||
}
|
||||
|
||||
// Unfortunately I couldn't determine how these are
|
||||
// supposed to be formatted. Pointers appreciated!
|
||||
// function parseImage(item) {
|
||||
// const uri = item.broadcastImageUrl
|
||||
|
||||
// return uri ? `https://???/${uri}` : null
|
||||
// }
|
||||
|
||||
function parseStart(item) {
|
||||
return dayjs(item.startTime)
|
||||
}
|
||||
|
||||
function parseStop(item) {
|
||||
return dayjs(item.endTime)
|
||||
}
|
||||
|
||||
function parseItems(content) {
|
||||
return JSON.parse(content).broadcasts
|
||||
}
|
||||
const dayjs = require('dayjs')
|
||||
|
||||
module.exports = {
|
||||
site: 'nhl.com',
|
||||
// I'm not sure what `endDate` represents but they only return 1 day of
|
||||
// results, with `endTime`s ocassionally in the following day.
|
||||
days: 1,
|
||||
url: ({ date }) =>
|
||||
`https://api-web.nhle.com/v1/network/tv-schedule/${date.toJSON().split('T')[0]}`,
|
||||
parser({ content }) {
|
||||
const programs = []
|
||||
const items = parseItems(content)
|
||||
for (const item of items) {
|
||||
programs.push({
|
||||
title: item.title,
|
||||
description: item.description === item.title ? undefined : item.description,
|
||||
category: 'Sports',
|
||||
// image: parseImage(item),
|
||||
start: parseStart(item),
|
||||
stop: parseStop(item)
|
||||
})
|
||||
}
|
||||
|
||||
return programs
|
||||
}
|
||||
}
|
||||
|
||||
// Unfortunately I couldn't determine how these are
|
||||
// supposed to be formatted. Pointers appreciated!
|
||||
// function parseImage(item) {
|
||||
// const uri = item.broadcastImageUrl
|
||||
|
||||
// return uri ? `https://???/${uri}` : null
|
||||
// }
|
||||
|
||||
function parseStart(item) {
|
||||
return dayjs(item.startTime)
|
||||
}
|
||||
|
||||
function parseStop(item) {
|
||||
return dayjs(item.endTime)
|
||||
}
|
||||
|
||||
function parseItems(content) {
|
||||
return JSON.parse(content).broadcasts
|
||||
}
|
||||
|
||||
@@ -1,44 +1,44 @@
|
||||
const { parser, url } = require('./nhl.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('2024-11-21', 'YYYY-MM-DD').startOf('d')
|
||||
|
||||
it('can generate valid url', () => {
|
||||
expect(url({ date })).toBe('https://api-web.nhle.com/v1/network/tv-schedule/2024-11-21')
|
||||
})
|
||||
|
||||
it('can parse response', () => {
|
||||
const content = fs.readFileSync(path.resolve(__dirname, '__data__/content.json'))
|
||||
let results = parser({ content, date })
|
||||
results = results.map(p => {
|
||||
p.start = p.start.toJSON()
|
||||
p.stop = p.stop.toJSON()
|
||||
return p
|
||||
})
|
||||
|
||||
expect(results[0]).toMatchObject({
|
||||
start: '2024-11-21T12:00:00.000Z',
|
||||
stop: '2024-11-21T13:00:00.000Z',
|
||||
title: 'On The Fly',
|
||||
category: 'Sports'
|
||||
})
|
||||
})
|
||||
|
||||
it('can handle empty guide', () => {
|
||||
const results = parser({
|
||||
content: JSON.stringify({
|
||||
// extra props not necessary but they form a valid response
|
||||
date: '2024-11-21',
|
||||
startDate: '2024-11-07',
|
||||
endDate: '2024-12-05',
|
||||
broadcasts: []
|
||||
})
|
||||
})
|
||||
expect(results).toMatchObject([])
|
||||
})
|
||||
const { parser, url } = require('./nhl.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('2024-11-21', 'YYYY-MM-DD').startOf('d')
|
||||
|
||||
it('can generate valid url', () => {
|
||||
expect(url({ date })).toBe('https://api-web.nhle.com/v1/network/tv-schedule/2024-11-21')
|
||||
})
|
||||
|
||||
it('can parse response', () => {
|
||||
const content = fs.readFileSync(path.resolve(__dirname, '__data__/content.json'))
|
||||
let results = parser({ content, date })
|
||||
results = results.map(p => {
|
||||
p.start = p.start.toJSON()
|
||||
p.stop = p.stop.toJSON()
|
||||
return p
|
||||
})
|
||||
|
||||
expect(results[0]).toMatchObject({
|
||||
start: '2024-11-21T12:00:00.000Z',
|
||||
stop: '2024-11-21T13:00:00.000Z',
|
||||
title: 'On The Fly',
|
||||
category: 'Sports'
|
||||
})
|
||||
})
|
||||
|
||||
it('can handle empty guide', () => {
|
||||
const results = parser({
|
||||
content: JSON.stringify({
|
||||
// extra props not necessary but they form a valid response
|
||||
date: '2024-11-21',
|
||||
startDate: '2024-11-07',
|
||||
endDate: '2024-12-05',
|
||||
broadcasts: []
|
||||
})
|
||||
})
|
||||
expect(results).toMatchObject([])
|
||||
})
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
# nhl.com
|
||||
|
||||
https://www.nhl.com/nhl-network/programming-schedule
|
||||
|
||||
### Download the guide
|
||||
|
||||
```sh
|
||||
npm run grab --- --site=nhl.com
|
||||
```
|
||||
|
||||
### Test
|
||||
|
||||
```sh
|
||||
npm test --- nhl.com
|
||||
```
|
||||
# nhl.com
|
||||
|
||||
https://www.nhl.com/nhl-network/programming-schedule
|
||||
|
||||
### Download the guide
|
||||
|
||||
```sh
|
||||
npm run grab --- --site=nhl.com
|
||||
```
|
||||
|
||||
### Test
|
||||
|
||||
```sh
|
||||
npm test --- nhl.com
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user