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 @@
# sky.com
https://www.sky.com/tv-guide
### Download the guide
```sh
npm run grab --- --site=sky.com
```
### Update channel list
```sh
npm run channels:parse --- --config=./sites/sky.com/sky.com.config.js --output=./sites/sky.com/sky.com.channels.xml
```
### Test
```sh
npm test --- sky.com
```
# sky.com
https://www.sky.com/tv-guide
### Download the guide
```sh
npm run grab --- --site=sky.com
```
### Update channel list
```sh
npm run channels:parse --- --config=./sites/sky.com/sky.com.config.js --output=./sites/sky.com/sky.com.channels.xml
```
### Test
```sh
npm test --- sky.com
```

File diff suppressed because it is too large Load Diff

View File

@@ -1,85 +1,85 @@
const cheerio = require('cheerio')
const dayjs = require('dayjs')
const utc = require('dayjs/plugin/utc')
const doFetch = require('@ntlab/sfetch')
const debug = require('debug')('site:sky.com')
const sortBy = require('lodash.sortby')
dayjs.extend(utc)
doFetch.setDebugger(debug)
module.exports = {
site: 'sky.com',
days: 2,
url({ date, channel }) {
return `https://awk.epgsky.com/hawk/linear/schedule/${date.format('YYYYMMDD')}/${
channel.site_id
}`
},
parser({ content, channel, date }) {
const programs = []
if (content) {
const items = JSON.parse(content) || null
if (Array.isArray(items.schedule)) {
items.schedule
.filter(schedule => schedule.sid === channel.site_id)
.forEach(schedule => {
if (Array.isArray(schedule.events)) {
sortBy(schedule.events, p => p.st).forEach(event => {
const start = dayjs.utc(event.st * 1000)
if (start.isSame(date, 'd')) {
const image = `https://images.metadata.sky.com/pd-image/${event.programmeuuid}/16-9/640`
programs.push({
title: event.t,
description: event.sy,
season: event.seasonnumber,
episode: event.episodenumber,
start,
stop: start.add(event.d, 's'),
icon: image,
image
})
}
})
}
})
}
}
return programs
},
async channels() {
const channels = {}
const queues = [{ t: 'r', url: 'https://www.sky.com/tv-guide' }]
await doFetch(queues, (queue, res) => {
// process regions
if (queue.t === 'r') {
const $ = cheerio.load(res)
const initialData = JSON.parse(decodeURIComponent($('#initialData').text()))
initialData.state.epgData.regions.forEach(region => {
queues.push({
t: 'c',
url: `https://awk.epgsky.com/hawk/linear/services/${region.bouquet}/${region.subBouquet}`
})
})
}
// process channels
if (queue.t === 'c') {
if (Array.isArray(res.services)) {
for (const ch of res.services) {
if (channels[ch.sid] === undefined) {
channels[ch.sid] = {
lang: 'en',
site_id: ch.sid,
name: ch.t
}
}
}
}
}
})
return Object.values(channels)
}
}
const cheerio = require('cheerio')
const dayjs = require('dayjs')
const utc = require('dayjs/plugin/utc')
const doFetch = require('@ntlab/sfetch')
const debug = require('debug')('site:sky.com')
const sortBy = require('lodash.sortby')
dayjs.extend(utc)
doFetch.setDebugger(debug)
module.exports = {
site: 'sky.com',
days: 2,
url({ date, channel }) {
return `https://awk.epgsky.com/hawk/linear/schedule/${date.format('YYYYMMDD')}/${
channel.site_id
}`
},
parser({ content, channel, date }) {
const programs = []
if (content) {
const items = JSON.parse(content) || null
if (Array.isArray(items.schedule)) {
items.schedule
.filter(schedule => schedule.sid === channel.site_id)
.forEach(schedule => {
if (Array.isArray(schedule.events)) {
sortBy(schedule.events, p => p.st).forEach(event => {
const start = dayjs.utc(event.st * 1000)
if (start.isSame(date, 'd')) {
const image = `https://images.metadata.sky.com/pd-image/${event.programmeuuid}/16-9/640`
programs.push({
title: event.t,
description: event.sy,
season: event.seasonnumber,
episode: event.episodenumber,
start,
stop: start.add(event.d, 's'),
icon: image,
image
})
}
})
}
})
}
}
return programs
},
async channels() {
const channels = {}
const queues = [{ t: 'r', url: 'https://www.sky.com/tv-guide' }]
await doFetch(queues, (queue, res) => {
// process regions
if (queue.t === 'r') {
const $ = cheerio.load(res)
const initialData = JSON.parse(decodeURIComponent($('#initialData').text()))
initialData.state.epgData.regions.forEach(region => {
queues.push({
t: 'c',
url: `https://awk.epgsky.com/hawk/linear/services/${region.bouquet}/${region.subBouquet}`
})
})
}
// process channels
if (queue.t === 'c') {
if (Array.isArray(res.services)) {
for (const ch of res.services) {
if (channels[ch.sid] === undefined) {
channels[ch.sid] = {
lang: 'en',
site_id: ch.sid,
name: ch.t
}
}
}
}
}
})
return Object.values(channels)
}
}

View File

@@ -1,61 +1,61 @@
const { parser, url } = require('./sky.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-12-14', 'YYYY-MM-DD').startOf('d')
const channel = {
site_id: '4086',
xmltv_id: 'SkyHistoryHD.uk'
}
it('can generate valid url', () => {
expect(url({ channel, date })).toBe('https://awk.epgsky.com/hawk/linear/schedule/20241214/4086')
})
it('can parse response', () => {
const content = fs.readFileSync(path.join(__dirname, '__data__', 'content.json'))
const result = parser({ content, channel, date }).map(p => {
p.start = p.start.toJSON()
p.stop = p.stop.toJSON()
return p
})
expect(result.length).toBe(31)
expect(result[0]).toMatchObject({
start: '2024-12-14T00:00:00.000Z',
stop: '2024-12-14T00:30:00.000Z',
title: 'Storage Wars',
description:
'A Sale Of Two Cities: Emily brings her mother along with her to Walnut, and Darrell wastes no time finding an advantage. Ivy and Ivy jr clean up with their locker. (S12, ep 4)',
season: 12,
episode: 4,
icon: 'https://images.metadata.sky.com/pd-image/b9572a38-8db7-471e-a2d7-462e1dd26af2/16-9/640',
image: 'https://images.metadata.sky.com/pd-image/b9572a38-8db7-471e-a2d7-462e1dd26af2/16-9/640'
})
expect(result[2]).toMatchObject({
start: '2024-12-14T01:00:00.000Z',
stop: '2024-12-14T01:30:00.000Z',
title: 'Storage Wars',
description:
'Not All That Glitters Is Gourd: Back in the city of Orange, the Vegas Ladies arrive in vintage style - though not everyone agrees. (S12, ep 6)',
season: 12,
episode: 6,
icon: 'https://images.metadata.sky.com/pd-image/e9521ccc-bdcc-4075-9c2e-bc835247148b/16-9/640',
image: 'https://images.metadata.sky.com/pd-image/e9521ccc-bdcc-4075-9c2e-bc835247148b/16-9/640'
})
})
it('can handle empty guide', () => {
const result = parser({
date,
channel,
content: ''
})
expect(result).toMatchObject([])
})
const { parser, url } = require('./sky.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-12-14', 'YYYY-MM-DD').startOf('d')
const channel = {
site_id: '4086',
xmltv_id: 'SkyHistoryHD.uk'
}
it('can generate valid url', () => {
expect(url({ channel, date })).toBe('https://awk.epgsky.com/hawk/linear/schedule/20241214/4086')
})
it('can parse response', () => {
const content = fs.readFileSync(path.join(__dirname, '__data__', 'content.json'))
const result = parser({ content, channel, date }).map(p => {
p.start = p.start.toJSON()
p.stop = p.stop.toJSON()
return p
})
expect(result.length).toBe(31)
expect(result[0]).toMatchObject({
start: '2024-12-14T00:00:00.000Z',
stop: '2024-12-14T00:30:00.000Z',
title: 'Storage Wars',
description:
'A Sale Of Two Cities: Emily brings her mother along with her to Walnut, and Darrell wastes no time finding an advantage. Ivy and Ivy jr clean up with their locker. (S12, ep 4)',
season: 12,
episode: 4,
icon: 'https://images.metadata.sky.com/pd-image/b9572a38-8db7-471e-a2d7-462e1dd26af2/16-9/640',
image: 'https://images.metadata.sky.com/pd-image/b9572a38-8db7-471e-a2d7-462e1dd26af2/16-9/640'
})
expect(result[2]).toMatchObject({
start: '2024-12-14T01:00:00.000Z',
stop: '2024-12-14T01:30:00.000Z',
title: 'Storage Wars',
description:
'Not All That Glitters Is Gourd: Back in the city of Orange, the Vegas Ladies arrive in vintage style - though not everyone agrees. (S12, ep 6)',
season: 12,
episode: 6,
icon: 'https://images.metadata.sky.com/pd-image/e9521ccc-bdcc-4075-9c2e-bc835247148b/16-9/640',
image: 'https://images.metadata.sky.com/pd-image/e9521ccc-bdcc-4075-9c2e-bc835247148b/16-9/640'
})
})
it('can handle empty guide', () => {
const result = parser({
date,
channel,
content: ''
})
expect(result).toMatchObject([])
})