mirror of
https://github.com/iptv-org/epg
synced 2026-05-01 06:56:59 -04:00
Replace LF line endings with CRLF
This commit is contained in:
@@ -1,21 +1,21 @@
|
||||
# streamingtvguides.com
|
||||
|
||||
https://streamingtvguides.com/
|
||||
|
||||
### Download the guide
|
||||
|
||||
```sh
|
||||
npm run grab --- --site=streamingtvguides.com
|
||||
```
|
||||
|
||||
### Update channel list
|
||||
|
||||
```sh
|
||||
npm run channels:parse --- --config=./sites/streamingtvguides.com/streamingtvguides.com.config.js --output=./sites/streamingtvguides.com/streamingtvguides.com.channels.xml
|
||||
```
|
||||
|
||||
### Test
|
||||
|
||||
```sh
|
||||
npm test --- streamingtvguides.com
|
||||
```
|
||||
# streamingtvguides.com
|
||||
|
||||
https://streamingtvguides.com/
|
||||
|
||||
### Download the guide
|
||||
|
||||
```sh
|
||||
npm run grab --- --site=streamingtvguides.com
|
||||
```
|
||||
|
||||
### Update channel list
|
||||
|
||||
```sh
|
||||
npm run channels:parse --- --config=./sites/streamingtvguides.com/streamingtvguides.com.config.js --output=./sites/streamingtvguides.com/streamingtvguides.com.channels.xml
|
||||
```
|
||||
|
||||
### Test
|
||||
|
||||
```sh
|
||||
npm test --- streamingtvguides.com
|
||||
```
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,98 +1,98 @@
|
||||
const cheerio = require('cheerio')
|
||||
const dayjs = require('dayjs')
|
||||
const customParseFormat = require('dayjs/plugin/customParseFormat')
|
||||
const timezone = require('dayjs/plugin/timezone')
|
||||
const sortBy = require('lodash.sortby')
|
||||
const uniqBy = require('lodash.uniqby')
|
||||
|
||||
dayjs.extend(customParseFormat)
|
||||
dayjs.extend(timezone)
|
||||
|
||||
module.exports = {
|
||||
site: 'streamingtvguides.com',
|
||||
days: 2,
|
||||
url({ channel }) {
|
||||
return `https://streamingtvguides.com/Channel/${channel.site_id}`
|
||||
},
|
||||
parser({ content, date }) {
|
||||
let programs = []
|
||||
const items = parseItems(content)
|
||||
items.forEach(item => {
|
||||
const $item = cheerio.load(item)
|
||||
const start = parseStart($item)
|
||||
if (!date.isSame(start, 'd')) return
|
||||
|
||||
programs.push({
|
||||
title: parseTitle($item),
|
||||
description: parseDescription($item),
|
||||
start,
|
||||
stop: parseStop($item)
|
||||
})
|
||||
})
|
||||
|
||||
programs = sortBy(uniqBy(programs, p => p.start), p => p.start.valueOf())
|
||||
|
||||
return programs
|
||||
},
|
||||
async channels() {
|
||||
const axios = require('axios')
|
||||
const data = await axios
|
||||
.get('https://streamingtvguides.com/Preferences')
|
||||
.then(r => r.data)
|
||||
.catch(console.log)
|
||||
|
||||
let channels = []
|
||||
|
||||
const $ = cheerio.load(data)
|
||||
$('#channel-group-all > div > div').each((i, el) => {
|
||||
const site_id = $(el).find('input').attr('value').replace('&', '&')
|
||||
const label = $(el).text().trim()
|
||||
const svgTitle = $(el).find('svg').attr('alt')
|
||||
const name = (label || svgTitle || '').replace(site_id, '').trim()
|
||||
|
||||
if (!name || !site_id) return
|
||||
|
||||
channels.push({
|
||||
lang: 'en',
|
||||
site_id,
|
||||
name
|
||||
})
|
||||
})
|
||||
|
||||
return channels
|
||||
}
|
||||
}
|
||||
|
||||
function parseTitle($item) {
|
||||
return $item('.card-body > .prog-contains > .card-title')
|
||||
.clone()
|
||||
.children()
|
||||
.remove()
|
||||
.end()
|
||||
.text()
|
||||
.trim()
|
||||
}
|
||||
|
||||
function parseDescription($item) {
|
||||
return $item('.card-body > .card-text').clone().children().remove().end().text().trim()
|
||||
}
|
||||
|
||||
function parseStart($item) {
|
||||
const date = $item('.card-body').clone().children().remove().end().text().trim()
|
||||
const [time] = date.split(' - ')
|
||||
|
||||
return dayjs.tz(time, 'YYYY-MM-DD HH:mm:ss [PST]', 'PST').utc()
|
||||
}
|
||||
|
||||
function parseStop($item) {
|
||||
const date = $item('.card-body').clone().children().remove().end().text().trim()
|
||||
const [, time] = date.split(' - ')
|
||||
|
||||
return dayjs.tz(time, 'YYYY-MM-DD HH:mm:ss [PST]', 'PST').utc()
|
||||
}
|
||||
|
||||
function parseItems(content) {
|
||||
const $ = cheerio.load(content)
|
||||
|
||||
return $('.container').toArray()
|
||||
}
|
||||
const cheerio = require('cheerio')
|
||||
const dayjs = require('dayjs')
|
||||
const customParseFormat = require('dayjs/plugin/customParseFormat')
|
||||
const timezone = require('dayjs/plugin/timezone')
|
||||
const sortBy = require('lodash.sortby')
|
||||
const uniqBy = require('lodash.uniqby')
|
||||
|
||||
dayjs.extend(customParseFormat)
|
||||
dayjs.extend(timezone)
|
||||
|
||||
module.exports = {
|
||||
site: 'streamingtvguides.com',
|
||||
days: 2,
|
||||
url({ channel }) {
|
||||
return `https://streamingtvguides.com/Channel/${channel.site_id}`
|
||||
},
|
||||
parser({ content, date }) {
|
||||
let programs = []
|
||||
const items = parseItems(content)
|
||||
items.forEach(item => {
|
||||
const $item = cheerio.load(item)
|
||||
const start = parseStart($item)
|
||||
if (!date.isSame(start, 'd')) return
|
||||
|
||||
programs.push({
|
||||
title: parseTitle($item),
|
||||
description: parseDescription($item),
|
||||
start,
|
||||
stop: parseStop($item)
|
||||
})
|
||||
})
|
||||
|
||||
programs = sortBy(uniqBy(programs, p => p.start), p => p.start.valueOf())
|
||||
|
||||
return programs
|
||||
},
|
||||
async channels() {
|
||||
const axios = require('axios')
|
||||
const data = await axios
|
||||
.get('https://streamingtvguides.com/Preferences')
|
||||
.then(r => r.data)
|
||||
.catch(console.log)
|
||||
|
||||
let channels = []
|
||||
|
||||
const $ = cheerio.load(data)
|
||||
$('#channel-group-all > div > div').each((i, el) => {
|
||||
const site_id = $(el).find('input').attr('value').replace('&', '&')
|
||||
const label = $(el).text().trim()
|
||||
const svgTitle = $(el).find('svg').attr('alt')
|
||||
const name = (label || svgTitle || '').replace(site_id, '').trim()
|
||||
|
||||
if (!name || !site_id) return
|
||||
|
||||
channels.push({
|
||||
lang: 'en',
|
||||
site_id,
|
||||
name
|
||||
})
|
||||
})
|
||||
|
||||
return channels
|
||||
}
|
||||
}
|
||||
|
||||
function parseTitle($item) {
|
||||
return $item('.card-body > .prog-contains > .card-title')
|
||||
.clone()
|
||||
.children()
|
||||
.remove()
|
||||
.end()
|
||||
.text()
|
||||
.trim()
|
||||
}
|
||||
|
||||
function parseDescription($item) {
|
||||
return $item('.card-body > .card-text').clone().children().remove().end().text().trim()
|
||||
}
|
||||
|
||||
function parseStart($item) {
|
||||
const date = $item('.card-body').clone().children().remove().end().text().trim()
|
||||
const [time] = date.split(' - ')
|
||||
|
||||
return dayjs.tz(time, 'YYYY-MM-DD HH:mm:ss [PST]', 'PST').utc()
|
||||
}
|
||||
|
||||
function parseStop($item) {
|
||||
const date = $item('.card-body').clone().children().remove().end().text().trim()
|
||||
const [, time] = date.split(' - ')
|
||||
|
||||
return dayjs.tz(time, 'YYYY-MM-DD HH:mm:ss [PST]', 'PST').utc()
|
||||
}
|
||||
|
||||
function parseItems(content) {
|
||||
const $ = cheerio.load(content)
|
||||
|
||||
return $('.container').toArray()
|
||||
}
|
||||
|
||||
@@ -1,53 +1,53 @@
|
||||
const { parser, url } = require('./streamingtvguides.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('2023-06-27', 'YYYY-MM-DD').startOf('d')
|
||||
const channel = {
|
||||
site_id: 'GMAPNY',
|
||||
xmltv_id: 'GMAPinoyTVUSACanada.ph'
|
||||
}
|
||||
|
||||
it('can generate valid url', () => {
|
||||
expect(url({ channel })).toBe('https://streamingtvguides.com/Channel/GMAPNY')
|
||||
})
|
||||
|
||||
it('can parse response', () => {
|
||||
const content = fs.readFileSync(path.resolve(__dirname, '__data__/content.html'), 'utf8')
|
||||
let results = parser({ content, date })
|
||||
results = results.map(p => {
|
||||
p.start = p.start.toJSON()
|
||||
p.stop = p.stop.toJSON()
|
||||
return p
|
||||
})
|
||||
|
||||
expect(results.length).toBe(38)
|
||||
|
||||
expect(results[0]).toMatchObject({
|
||||
start: '2023-06-27T00:40:00.000Z',
|
||||
stop: '2023-06-27T02:00:00.000Z',
|
||||
title: '24 Oras',
|
||||
description: 'Up to the minute news around the world.'
|
||||
})
|
||||
|
||||
expect(results[37]).toMatchObject({
|
||||
start: '2023-06-27T21:50:00.000Z',
|
||||
stop: '2023-06-28T00:00:00.000Z',
|
||||
title: 'Eat Bulaga',
|
||||
description: 'Rousing and engrossing segments with engaging hosts.'
|
||||
})
|
||||
})
|
||||
|
||||
it('can handle empty guide', () => {
|
||||
const content = fs.readFileSync(path.resolve(__dirname, '__data__/no_content.html'), 'utf8')
|
||||
const result = parser({
|
||||
date,
|
||||
content
|
||||
})
|
||||
expect(result).toMatchObject([])
|
||||
})
|
||||
const { parser, url } = require('./streamingtvguides.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('2023-06-27', 'YYYY-MM-DD').startOf('d')
|
||||
const channel = {
|
||||
site_id: 'GMAPNY',
|
||||
xmltv_id: 'GMAPinoyTVUSACanada.ph'
|
||||
}
|
||||
|
||||
it('can generate valid url', () => {
|
||||
expect(url({ channel })).toBe('https://streamingtvguides.com/Channel/GMAPNY')
|
||||
})
|
||||
|
||||
it('can parse response', () => {
|
||||
const content = fs.readFileSync(path.resolve(__dirname, '__data__/content.html'), 'utf8')
|
||||
let results = parser({ content, date })
|
||||
results = results.map(p => {
|
||||
p.start = p.start.toJSON()
|
||||
p.stop = p.stop.toJSON()
|
||||
return p
|
||||
})
|
||||
|
||||
expect(results.length).toBe(38)
|
||||
|
||||
expect(results[0]).toMatchObject({
|
||||
start: '2023-06-27T00:40:00.000Z',
|
||||
stop: '2023-06-27T02:00:00.000Z',
|
||||
title: '24 Oras',
|
||||
description: 'Up to the minute news around the world.'
|
||||
})
|
||||
|
||||
expect(results[37]).toMatchObject({
|
||||
start: '2023-06-27T21:50:00.000Z',
|
||||
stop: '2023-06-28T00:00:00.000Z',
|
||||
title: 'Eat Bulaga',
|
||||
description: 'Rousing and engrossing segments with engaging hosts.'
|
||||
})
|
||||
})
|
||||
|
||||
it('can handle empty guide', () => {
|
||||
const content = fs.readFileSync(path.resolve(__dirname, '__data__/no_content.html'), 'utf8')
|
||||
const result = parser({
|
||||
date,
|
||||
content
|
||||
})
|
||||
expect(result).toMatchObject([])
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user