mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-11 17:40:07 -04:00
Merge pull request #1142 from iptv-org/add-watchyour.tv
Add guide from watchyour.tv
This commit is contained in:
commit
94e895c315
4 changed files with 162 additions and 0 deletions
17
.github/workflows/watchyour.tv.yml
vendored
Normal file
17
.github/workflows/watchyour.tv.yml
vendored
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
name: watchyour.tv
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
- cron: '0 3 * * *'
|
||||||
|
workflow_dispatch:
|
||||||
|
workflow_run:
|
||||||
|
workflows: [_trigger]
|
||||||
|
types:
|
||||||
|
- completed
|
||||||
|
jobs:
|
||||||
|
load:
|
||||||
|
uses: ./.github/workflows/_load.yml
|
||||||
|
with:
|
||||||
|
site: ${{github.workflow}}
|
||||||
|
secrets:
|
||||||
|
APP_ID: ${{ secrets.APP_ID }}
|
||||||
|
APP_PRIVATE_KEY: ${{ secrets.APP_PRIVATE_KEY }}
|
54
sites/watchyour.tv/watchyour.tv.config.js
Normal file
54
sites/watchyour.tv/watchyour.tv.config.js
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
const dayjs = require('dayjs')
|
||||||
|
const axios = require('axios')
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
site: 'watchyour.tv',
|
||||||
|
url: `https://www.watchyour.tv/guide.json`,
|
||||||
|
request: {
|
||||||
|
cache: {
|
||||||
|
ttl: 60 * 60 * 1000 // 1 hour
|
||||||
|
}
|
||||||
|
},
|
||||||
|
parser: function ({ content, date, channel }) {
|
||||||
|
let programs = []
|
||||||
|
const items = parseItems(content, date, channel)
|
||||||
|
items.forEach(item => {
|
||||||
|
const start = parseStart(item)
|
||||||
|
const stop = start.add(parseInt(item.duration), 'm')
|
||||||
|
programs.push({
|
||||||
|
title: item.name,
|
||||||
|
icon: item.icon,
|
||||||
|
category: item.category,
|
||||||
|
start,
|
||||||
|
stop
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
return programs
|
||||||
|
},
|
||||||
|
async channels() {
|
||||||
|
const data = await axios
|
||||||
|
.get(`https://www.watchyour.tv/guide.json`)
|
||||||
|
.then(r => r.data)
|
||||||
|
.catch(console.log)
|
||||||
|
|
||||||
|
return data.map(item => ({
|
||||||
|
site_id: item.id,
|
||||||
|
name: item.name
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseStart(item) {
|
||||||
|
return dayjs.unix(parseInt(item.tms))
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseItems(content, date, channel) {
|
||||||
|
if (!content) return []
|
||||||
|
const data = JSON.parse(content)
|
||||||
|
if (!Array.isArray(data)) return []
|
||||||
|
const channelData = data.find(i => i.id == channel.site_id)
|
||||||
|
if (!channelData || !Array.isArray(channelData.shows)) return []
|
||||||
|
|
||||||
|
return channelData.shows.filter(i => i.start_day === date.format('YYYY-MM-DD'))
|
||||||
|
}
|
47
sites/watchyour.tv/watchyour.tv.test.js
Normal file
47
sites/watchyour.tv/watchyour.tv.test.js
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
// npx epg-grabber --config=sites/watchyour.tv/watchyour.tv.config.js --channels=sites/watchyour.tv/watchyour.tv_us.channels.xml --output=guide.xml --days=2
|
||||||
|
// npm run channels:parse -- --config=./sites/watchyour.tv/watchyour.tv.config.js --output=./sites/watchyour.tv/watchyour.tv_us.channels.xml
|
||||||
|
|
||||||
|
const { parser, url } = require('./watchyour.tv.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-10-03', 'YYYY-MM-DD').startOf('d')
|
||||||
|
const channel = {
|
||||||
|
site_id: '735',
|
||||||
|
xmltv_id: 'TVSClassicSports.us'
|
||||||
|
}
|
||||||
|
|
||||||
|
it('can generate valid url', () => {
|
||||||
|
expect(url).toBe('https://www.watchyour.tv/guide.json')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('can parse response', () => {
|
||||||
|
const content = `[{"name":"TVS Classic Sports","icon":"https://www.watchyour.tv/epg/channellogos/tvs-classic-sports.png","language":"English","id":"735","shows":[{"name":"1979 WVU vs Penn State","category":"Sports","start_day":"2022-10-03","start":"04:00:00","end_day":"2022-10-03","end":"06:00:45","duration":"121","url":"http://rpn1.bozztv.com/36bay2/gusa-tvs/index-1664769600-7245.m3u8?token=f7410a9414f61579dced17ac1bbdb971","icon":"https://example.com/image.png","timezone":"+0000","tms":"1664769600"},{"name":"1958 NCAA University of Kentucky vs Seattle U","category":"Sports","start_day":"2022-10-04","start":"00:58:50","end_day":"2022-10-04","end":"01:44:11","duration":"46","url":"http://rpn1.bozztv.com/36bay2/gusa-tvs/index.m3u8?token=93e7b201f544c87296076b73f9d880ae","icon":"","timezone":"+0000","tms":"1664845130"}]}]`
|
||||||
|
const result = parser({ content, date, channel }).map(p => {
|
||||||
|
p.start = p.start.toJSON()
|
||||||
|
p.stop = p.stop.toJSON()
|
||||||
|
return p
|
||||||
|
})
|
||||||
|
|
||||||
|
expect(result).toMatchObject([
|
||||||
|
{
|
||||||
|
start: '2022-10-03T04:00:00.000Z',
|
||||||
|
stop: '2022-10-03T06:01:00.000Z',
|
||||||
|
title: '1979 WVU vs Penn State',
|
||||||
|
icon: 'https://example.com/image.png',
|
||||||
|
category: 'Sports'
|
||||||
|
}
|
||||||
|
])
|
||||||
|
})
|
||||||
|
|
||||||
|
it('can handle empty guide', () => {
|
||||||
|
const result = parser({
|
||||||
|
content: ``,
|
||||||
|
date,
|
||||||
|
channel
|
||||||
|
})
|
||||||
|
expect(result).toMatchObject([])
|
||||||
|
})
|
44
sites/watchyour.tv/watchyour.tv_us.channels.xml
Normal file
44
sites/watchyour.tv/watchyour.tv_us.channels.xml
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<site site="watchyour.tv">
|
||||||
|
<channels>
|
||||||
|
<channel lang="en" xmltv_id="TVSBoxing.us" site_id="786">TVS Boxing Network</channel>
|
||||||
|
<channel lang="en" xmltv_id="TVSCipherNetwork.us" site_id="843">TVS Cipher Network</channel>
|
||||||
|
<channel lang="en" xmltv_id="TVSClassicMovies.us" site_id="820">TVS Classic Movies</channel>
|
||||||
|
<channel lang="en" xmltv_id="TVSClassicSports.us" site_id="735">TVS Classic Sports</channel>
|
||||||
|
<channel lang="en" xmltv_id="TVSComedyNetwork.us" site_id="829">TVS Comedy</channel>
|
||||||
|
<channel lang="en" xmltv_id="TVSDriveInMovie.us" site_id="819">TVS Drive In Movie</channel>
|
||||||
|
<channel lang="en" xmltv_id="TVSFilmNoirNetwork.us" site_id="842">TVS Film Noir Network</channel>
|
||||||
|
<channel lang="en" xmltv_id="TVSFrontPageDetective.us" site_id="844">TVS Front Page Detective</channel>
|
||||||
|
<channel lang="en" xmltv_id="TVSHiTops.us" site_id="816">TVS Hi Tops</channel>
|
||||||
|
<channel lang="en" xmltv_id="TVSHollywoodHistory.us" site_id="823">TVS Hollywood History</channel>
|
||||||
|
<channel lang="en" xmltv_id="TVSHorrorNetwork.us" site_id="825">TVS Horror</channel>
|
||||||
|
<channel lang="en" xmltv_id="TVSMainstreet.us" site_id="799">TVS Main Street</channel>
|
||||||
|
<channel lang="en" xmltv_id="TVSNostalgia.us" site_id="797">TVS Nostalgia</channel>
|
||||||
|
<channel lang="en" xmltv_id="TVSNostalgiaMovies.us" site_id="822">TVS Nostalgia Movie Network</channel>
|
||||||
|
<channel lang="en" xmltv_id="TVSPinballNetwork.us" site_id="837">TVS Pinball Network</channel>
|
||||||
|
<channel lang="en" xmltv_id="TVSQuizShowNetwork.us" site_id="830">TVS Quiz Show Network</channel>
|
||||||
|
<channel lang="en" xmltv_id="TVSSelectNetwork.us" site_id="827">TVS Select Network</channel>
|
||||||
|
<channel lang="en" xmltv_id="TVSSiloDiscountNetwork.us" site_id="847">TVS Silo Discount Network</channel>
|
||||||
|
<channel lang="en" xmltv_id="TVSTallyHo.us" site_id="826">TVS Tally Ho</channel>
|
||||||
|
<channel lang="en" xmltv_id="TVSTavern.us" site_id="795">TVS Tavern TV</channel>
|
||||||
|
<channel lang="en" xmltv_id="TVSTodayHomeEntertainmentNetwork.us" site_id="841">TVS Today Home Entertainment Network</channel>
|
||||||
|
<channel lang="en" xmltv_id="TVSTurbo.us" site_id="793">TVS Turbo Network</channel>
|
||||||
|
<channel lang="en" xmltv_id="TVSWesternMovie.us" site_id="821">TVS Western Movie</channel>
|
||||||
|
<channel lang="en" xmltv_id="TVSWomenSports.us" site_id="798">TVS Women's Sports Network</channel>
|
||||||
|
<!-- <channel lang="en" xmltv_id="" site_id="796">TVS All American</channel> -->
|
||||||
|
<!-- <channel lang="en" xmltv_id="" site_id="802">TVS Buckboard Network</channel> -->
|
||||||
|
<!-- <channel lang="en" xmltv_id="" site_id="815">TVS Flashback Network</channel> -->
|
||||||
|
<!-- <channel lang="en" xmltv_id="" site_id="817">TVS Light Network</channel> -->
|
||||||
|
<!-- <channel lang="en" xmltv_id="" site_id="818">TVS Tel Ra Network</channel> -->
|
||||||
|
<!-- <channel lang="en" xmltv_id="" site_id="824">TVS Port O Call</channel> -->
|
||||||
|
<!-- <channel lang="en" xmltv_id="" site_id="831">Rare Collectibles Televison</channel> -->
|
||||||
|
<!-- <channel lang="en" xmltv_id="" site_id="832">TVS TeleSports</channel> -->
|
||||||
|
<!-- <channel lang="en" xmltv_id="" site_id="834">Pet Parade Network</channel> -->
|
||||||
|
<!-- <channel lang="en" xmltv_id="" site_id="840">TVS Consumer Direct</channel> -->
|
||||||
|
<!-- <channel lang="en" xmltv_id="" site_id="845">TVS Opus Network</channel> -->
|
||||||
|
<!-- <channel lang="en" xmltv_id="" site_id="846">TVS Talk Network</channel> -->
|
||||||
|
<!-- <channel lang="en" xmltv_id="" site_id="848">TVS Bazaar of All Nations</channel> -->
|
||||||
|
<!-- <channel lang="en" xmltv_id="" site_id="849">TVS Vintage Network</channel> -->
|
||||||
|
<!-- <channel lang="en" xmltv_id="" site_id="850">TVS Soft Winds Network</channel> -->
|
||||||
|
</channels>
|
||||||
|
</site>
|
Loading…
Add table
Add a link
Reference in a new issue