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

View File

@@ -1,21 +1,21 @@
# watch.sportsnet.ca
https://watch.sportsnet.ca/schedule/tvlistings
### Download the guide
```sh
npm run grab --- --site=watch.sportsnet.ca
```
### Update channel list
```sh
npm run channels:parse --- --config=./sites/watch.sportsnet.ca/watch.sportsnet.ca.config.js --output=./sites/watch.sportsnet.ca/watch.sportsnet.ca.channels.xml
```
### Test
```sh
npm test --- watch.sportsnet.ca
```
# watch.sportsnet.ca
https://watch.sportsnet.ca/schedule/tvlistings
### Download the guide
```sh
npm run grab --- --site=watch.sportsnet.ca
```
### Update channel list
```sh
npm run channels:parse --- --config=./sites/watch.sportsnet.ca/watch.sportsnet.ca.config.js --output=./sites/watch.sportsnet.ca/watch.sportsnet.ca.channels.xml
```
### Test
```sh
npm test --- watch.sportsnet.ca
```

View File

@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<channels>
<channel site="watch.sportsnet.ca" lang="en" xmltv_id="Sportsnet360.ca" site_id="24467">SN 360</channel>
<channel site="watch.sportsnet.ca" lang="en" xmltv_id="Sportsnet.ca@East" site_id="24466">SN East</channel>
<channel site="watch.sportsnet.ca" lang="en" xmltv_id="SportsnetOne.ca" site_id="24469">SN One</channel>
<channel site="watch.sportsnet.ca" lang="en" xmltv_id="Sportsnet.ca@Ontario" site_id="24533">SN Ontario</channel>
<channel site="watch.sportsnet.ca" lang="en" xmltv_id="Sportsnet.ca@Pacific" site_id="24530">SN Pacific</channel>
<channel site="watch.sportsnet.ca" lang="en" xmltv_id="Sportsnet.ca@West" site_id="24468">SN West</channel>
<channel site="watch.sportsnet.ca" lang="en" xmltv_id="SportsnetWorld.ca" site_id="5895">SN World</channel>
<channel site="watch.sportsnet.ca" lang="en" xmltv_id="WWENetwork.ca" site_id="29659">WWE Network</channel>
</channels>
<?xml version="1.0" encoding="UTF-8"?>
<channels>
<channel site="watch.sportsnet.ca" lang="en" xmltv_id="Sportsnet360.ca" site_id="24467">SN 360</channel>
<channel site="watch.sportsnet.ca" lang="en" xmltv_id="Sportsnet.ca@East" site_id="24466">SN East</channel>
<channel site="watch.sportsnet.ca" lang="en" xmltv_id="SportsnetOne.ca" site_id="24469">SN One</channel>
<channel site="watch.sportsnet.ca" lang="en" xmltv_id="Sportsnet.ca@Ontario" site_id="24533">SN Ontario</channel>
<channel site="watch.sportsnet.ca" lang="en" xmltv_id="Sportsnet.ca@Pacific" site_id="24530">SN Pacific</channel>
<channel site="watch.sportsnet.ca" lang="en" xmltv_id="Sportsnet.ca@West" site_id="24468">SN West</channel>
<channel site="watch.sportsnet.ca" lang="en" xmltv_id="SportsnetWorld.ca" site_id="5895">SN World</channel>
<channel site="watch.sportsnet.ca" lang="en" xmltv_id="WWENetwork.ca" site_id="29659">WWE Network</channel>
</channels>

View File

@@ -1,69 +1,69 @@
const dayjs = require('dayjs')
const utc = require('dayjs/plugin/utc')
dayjs.extend(utc)
module.exports = {
site: 'watch.sportsnet.ca',
days: 2,
url: function ({ channel, date }) {
return `https://production-cdn.sportsnet.ca/api/schedules?channels=${
channel.site_id
}&date=${date.format('YYYY-MM-DD')}&duration=24&hour=0`
},
parser: function ({ content }) {
let programs = []
const items = parseItems(content)
items.forEach(item => {
programs.push({
title: item.item.title,
description: item.item.shortDescription,
image: parseImage(item),
start: parseStart(item),
stop: parseStop(item)
})
})
return programs
},
async channels() {
const axios = require('axios')
const html = await axios
.get('https://watch.sportsnet.ca/schedule/tvlistings')
.then(r => r.data)
.catch(console.log)
let [, __data] = html.match(/window\.__data = ([^<]+)<\/script>/)
const func = new Function(`"use strict";return ${__data}`)
const data = func()
return data.cache.list['678|page_size=24'].list.items.map(item => {
return {
lang: 'en',
site_id: item.id,
name: item.title
}
})
}
}
function parseImage(item) {
if (!item.item || !item.item.images) return null
return item.item.images.tile
}
function parseStart(item) {
return dayjs.utc(item.startDate)
}
function parseStop(item) {
return dayjs.utc(item.endDate)
}
function parseItems(content) {
const data = JSON.parse(content)
if (!Array.isArray(data) || !Array.isArray(data[0].schedules)) return []
return data[0].schedules
}
const dayjs = require('dayjs')
const utc = require('dayjs/plugin/utc')
dayjs.extend(utc)
module.exports = {
site: 'watch.sportsnet.ca',
days: 2,
url: function ({ channel, date }) {
return `https://production-cdn.sportsnet.ca/api/schedules?channels=${
channel.site_id
}&date=${date.format('YYYY-MM-DD')}&duration=24&hour=0`
},
parser: function ({ content }) {
let programs = []
const items = parseItems(content)
items.forEach(item => {
programs.push({
title: item.item.title,
description: item.item.shortDescription,
image: parseImage(item),
start: parseStart(item),
stop: parseStop(item)
})
})
return programs
},
async channels() {
const axios = require('axios')
const html = await axios
.get('https://watch.sportsnet.ca/schedule/tvlistings')
.then(r => r.data)
.catch(console.log)
let [, __data] = html.match(/window\.__data = ([^<]+)<\/script>/)
const func = new Function(`"use strict";return ${__data}`)
const data = func()
return data.cache.list['678|page_size=24'].list.items.map(item => {
return {
lang: 'en',
site_id: item.id,
name: item.title
}
})
}
}
function parseImage(item) {
if (!item.item || !item.item.images) return null
return item.item.images.tile
}
function parseStart(item) {
return dayjs.utc(item.startDate)
}
function parseStop(item) {
return dayjs.utc(item.endDate)
}
function parseItems(content) {
const data = JSON.parse(content)
if (!Array.isArray(data) || !Array.isArray(data[0].schedules)) return []
return data[0].schedules
}

View File

@@ -1,48 +1,48 @@
const { parser, url } = require('./watch.sportsnet.ca.config.js')
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('2022-03-14', 'YYYY-MM-DD').startOf('d')
const channel = {
site_id: '24533',
xmltv_id: 'SportsNetOntario.ca'
}
it('can generate valid url', () => {
expect(url({ channel, date })).toBe(
'https://production-cdn.sportsnet.ca/api/schedules?channels=24533&date=2022-03-14&duration=24&hour=0'
)
})
it('can parse response', () => {
const content =
'[{"channelId":"24533","startDate":"2022-03-14T00:00:00.000Z","endDate":"2022-03-15T00:00:00.000Z","schedules":[{"channelId":"24533","customFields":{"ContentId":"EP029977175139","Checksum":"2DA90E7E66B9C311F98B186B89C50FAD"},"endDate":"2022-03-14T02:30:00Z","id":"826cb731-9de4-4cf3-bcca-d548d8a33d16","startDate":"2022-03-14T00:00:00Z","item":{"id":"34a028b0-eacf-40f3-9bf9-62ee3330df1b","type":"program","title":"Calgary Flames at Colorado Avalanche","shortDescription":"Johnny Gaudreau and the Flames pay a visit to the Avalanche. Calgary won 4-3 in overtime March 5.","path":"/channel/24533","duration":9000,"images":{"tile":"https://production-static.sportsnet-static.com/shain/v1/dataservice/ResizeImage/$value?Format=\'jpg\'&Quality=85&ImageId=\'785305\'&EntityType=\'LinearSchedule\'&EntityId=\'826cb731-9de4-4cf3-bcca-d548d8a33d16\'&Width=3840&Height=2160","wallpaper":"https://production-static.sportsnet-static.com/shain/v1/dataservice/ResizeImage/$value?Format=\'jpg\'&Quality=85&ImageId=\'785311\'&EntityType=\'LinearSchedule\'&EntityId=\'826cb731-9de4-4cf3-bcca-d548d8a33d16\'&Width=3840&Height=2160"}}}]}]'
const result = parser({ content }).map(p => {
p.start = p.start.toJSON()
p.stop = p.stop.toJSON()
return p
})
expect(result).toMatchObject([
{
start: '2022-03-14T00:00:00.000Z',
stop: '2022-03-14T02:30:00.000Z',
title: 'Calgary Flames at Colorado Avalanche',
description:
'Johnny Gaudreau and the Flames pay a visit to the Avalanche. Calgary won 4-3 in overtime March 5.',
image:
"https://production-static.sportsnet-static.com/shain/v1/dataservice/ResizeImage/$value?Format='jpg'&Quality=85&ImageId='785305'&EntityType='LinearSchedule'&EntityId='826cb731-9de4-4cf3-bcca-d548d8a33d16'&Width=3840&Height=2160"
}
])
})
it('can handle empty guide', () => {
const result = parser({
content:
'[{"channelId":"245321","startDate":"2022-03-14T00:00:00.000Z","endDate":"2022-03-15T00:00:00.000Z","schedules":[]}]'
})
expect(result).toMatchObject([])
})
const { parser, url } = require('./watch.sportsnet.ca.config.js')
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('2022-03-14', 'YYYY-MM-DD').startOf('d')
const channel = {
site_id: '24533',
xmltv_id: 'SportsNetOntario.ca'
}
it('can generate valid url', () => {
expect(url({ channel, date })).toBe(
'https://production-cdn.sportsnet.ca/api/schedules?channels=24533&date=2022-03-14&duration=24&hour=0'
)
})
it('can parse response', () => {
const content =
'[{"channelId":"24533","startDate":"2022-03-14T00:00:00.000Z","endDate":"2022-03-15T00:00:00.000Z","schedules":[{"channelId":"24533","customFields":{"ContentId":"EP029977175139","Checksum":"2DA90E7E66B9C311F98B186B89C50FAD"},"endDate":"2022-03-14T02:30:00Z","id":"826cb731-9de4-4cf3-bcca-d548d8a33d16","startDate":"2022-03-14T00:00:00Z","item":{"id":"34a028b0-eacf-40f3-9bf9-62ee3330df1b","type":"program","title":"Calgary Flames at Colorado Avalanche","shortDescription":"Johnny Gaudreau and the Flames pay a visit to the Avalanche. Calgary won 4-3 in overtime March 5.","path":"/channel/24533","duration":9000,"images":{"tile":"https://production-static.sportsnet-static.com/shain/v1/dataservice/ResizeImage/$value?Format=\'jpg\'&Quality=85&ImageId=\'785305\'&EntityType=\'LinearSchedule\'&EntityId=\'826cb731-9de4-4cf3-bcca-d548d8a33d16\'&Width=3840&Height=2160","wallpaper":"https://production-static.sportsnet-static.com/shain/v1/dataservice/ResizeImage/$value?Format=\'jpg\'&Quality=85&ImageId=\'785311\'&EntityType=\'LinearSchedule\'&EntityId=\'826cb731-9de4-4cf3-bcca-d548d8a33d16\'&Width=3840&Height=2160"}}}]}]'
const result = parser({ content }).map(p => {
p.start = p.start.toJSON()
p.stop = p.stop.toJSON()
return p
})
expect(result).toMatchObject([
{
start: '2022-03-14T00:00:00.000Z',
stop: '2022-03-14T02:30:00.000Z',
title: 'Calgary Flames at Colorado Avalanche',
description:
'Johnny Gaudreau and the Flames pay a visit to the Avalanche. Calgary won 4-3 in overtime March 5.',
image:
"https://production-static.sportsnet-static.com/shain/v1/dataservice/ResizeImage/$value?Format='jpg'&Quality=85&ImageId='785305'&EntityType='LinearSchedule'&EntityId='826cb731-9de4-4cf3-bcca-d548d8a33d16'&Width=3840&Height=2160"
}
])
})
it('can handle empty guide', () => {
const result = parser({
content:
'[{"channelId":"245321","startDate":"2022-03-14T00:00:00.000Z","endDate":"2022-03-15T00:00:00.000Z","schedules":[]}]'
})
expect(result).toMatchObject([])
})