Merge pull request #124 from iptv-org/add-guide-from-rev-bs

Add guide from rev.bs
This commit is contained in:
Aleksandr Statciuk 2021-10-01 21:38:09 +03:00 committed by GitHub
commit c07bf5d676
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 77 additions and 0 deletions

View file

@ -34,6 +34,7 @@ jobs:
programetv.ro, programetv.ro,
programme-tv.net, programme-tv.net,
programtv.onet.pl, programtv.onet.pl,
rev.bs,
telkussa.fi, telkussa.fi,
tv.cctv.com, tv.cctv.com,
tv.lv, tv.lv,

View file

@ -30,6 +30,7 @@ To load a program guide, all you need to do is copy the link to one or more of t
<tr><td align="left" nowrap>🇦🇺 Australia</td><td align="left" nowrap><code>https://iptv-org.github.io/epg/guides/ontvtonight.com.guide.xml</code></td></tr> <tr><td align="left" nowrap>🇦🇺 Australia</td><td align="left" nowrap><code>https://iptv-org.github.io/epg/guides/ontvtonight.com.guide.xml</code></td></tr>
<tr><td align="left" nowrap>🇦🇹 Austria</td><td align="left" nowrap><code>https://iptv-org.github.io/epg/guides/hd-plus.de.guide.xml</code></td></tr> <tr><td align="left" nowrap>🇦🇹 Austria</td><td align="left" nowrap><code>https://iptv-org.github.io/epg/guides/hd-plus.de.guide.xml</code></td></tr>
<tr><td align="left" nowrap>🇦🇿 Azerbaijan</td><td align="left" nowrap><code>https://iptv-org.github.io/epg/guides/tv.mail.ru.guide.xml</code></td></tr> <tr><td align="left" nowrap>🇦🇿 Azerbaijan</td><td align="left" nowrap><code>https://iptv-org.github.io/epg/guides/tv.mail.ru.guide.xml</code></td></tr>
<tr><td align="left" nowrap>🇧🇸 Bahamas</td><td align="left" nowrap><code>https://iptv-org.github.io/epg/guides/rev.bs.guide.xml</code></td></tr>
<tr><td align="left" nowrap>🇧🇾 Belarus</td><td align="left" nowrap><code>https://iptv-org.github.io/epg/guides/tv.mail.ru.guide.xml</code></td></tr> <tr><td align="left" nowrap>🇧🇾 Belarus</td><td align="left" nowrap><code>https://iptv-org.github.io/epg/guides/tv.mail.ru.guide.xml</code></td></tr>
<tr><td align="left" nowrap>🇧🇯 Benin</td><td align="left" nowrap><code>https://iptv-org.github.io/epg/guides/dstv.com.guide.xml</code></td></tr> <tr><td align="left" nowrap>🇧🇯 Benin</td><td align="left" nowrap><code>https://iptv-org.github.io/epg/guides/dstv.com.guide.xml</code></td></tr>
<tr><td align="left" nowrap>🇧🇴 Bolivia</td><td align="left" nowrap><code>https://iptv-org.github.io/epg/guides/comteco.com.bo.guide.xml</code></td></tr> <tr><td align="left" nowrap>🇧🇴 Bolivia</td><td align="left" nowrap><code>https://iptv-org.github.io/epg/guides/comteco.com.bo.guide.xml</code></td></tr>

1
package-lock.json generated
View file

@ -16,6 +16,7 @@
"html-to-text": "^7.0.0", "html-to-text": "^7.0.0",
"iconv-lite": "^0.4.24", "iconv-lite": "^0.4.24",
"jsdom": "^16.5.0", "jsdom": "^16.5.0",
"lodash": "^4.17.21",
"parse-duration": "^1.0.0", "parse-duration": "^1.0.0",
"tabletojson": "^2.0.7", "tabletojson": "^2.0.7",
"xml-js": "^1.6.11" "xml-js": "^1.6.11"

View file

@ -16,6 +16,7 @@
"html-to-text": "^7.0.0", "html-to-text": "^7.0.0",
"iconv-lite": "^0.4.24", "iconv-lite": "^0.4.24",
"jsdom": "^16.5.0", "jsdom": "^16.5.0",
"lodash": "^4.17.21",
"parse-duration": "^1.0.0", "parse-duration": "^1.0.0",
"tabletojson": "^2.0.7", "tabletojson": "^2.0.7",
"xml-js": "^1.6.11" "xml-js": "^1.6.11"

9
sites/rev.bs.channels.xml Executable file
View file

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<site site="rev.bs">
<channels>
<channel site_id="211" xmltv_id="ZNSTV.bs" logo="https://zap2it.tmsimg.com///zap2it.tmsimg.com/h3/NowShowing/36504/s36504_h3_aa.png">ZNS TV</channel>
<channel site_id="212" xmltv_id="OurTV.bs" logo="https://zap2it.tmsimg.com/h3/NowShowing/50522/s50522_h3_aa.png">Our TV</channel>
<channel site_id="214" xmltv_id="JCNChannel14.bs" logo="https://zap2it.tmsimg.com///zap2it.tmsimg.com/h5/NowShowing/56653/s56653_h5_ba.png">JCN Channel 14</channel>
<channel site_id="224" xmltv_id="IslandLuckTV.bs" logo="https://zap2it.tmsimg.com/h3/NowShowing/101310/s101310_h3_aa.png">Island Luck TV</channel>
</channels>
</site>

64
sites/rev.bs.config.js Normal file
View file

@ -0,0 +1,64 @@
const dayjs = require('dayjs')
const utc = require('dayjs/plugin/utc')
const timezone = require('dayjs/plugin/timezone')
const axios = require('axios')
const _ = require('lodash')
dayjs.extend(utc)
dayjs.extend(timezone)
const endpoint = `https://www.rev.bs/wp-content/uploads/tv-guide/$date_$index.json`
module.exports = {
lang: 'en',
site: 'rev.bs',
days: 3,
channels: 'rev.bs.channels.xml',
output: '.gh-pages/guides/rev.bs.guide.xml',
url: function ({ date }) {
return endpoint.replace('$date', date.format('YYYY-MM-DD')).replace('$index', 0)
},
parser: async function ({ content, channel, date }) {
const programs = []
const items0 = parseItems(content, channel)
const items1 = parseItems(await loadNextItems(date, 1), channel)
const items2 = parseItems(await loadNextItems(date, 2), channel)
const items3 = parseItems(await loadNextItems(date, 3), channel)
const items = _.unionBy(items0, items1, items2, items3, 'sid')
items.forEach(item => {
const start = parseStart(item, date)
const stop = start.add(item.duration, 'm')
programs.push({
title: item.title,
start,
stop
})
})
return programs
}
}
async function loadNextItems(date, index) {
const url = endpoint.replace('$date', date.format('YYYY-MM-DD')).replace('$index', index)
return axios
.get(url, {
responseType: 'arraybuffer'
})
.then(res => res.data.toString())
.catch(e => ({}))
}
function parseStart(item, d) {
const shift = parseInt(item.s)
return dayjs.tz(d.add(shift, 'm').toString(), 'America/New_York')
}
function parseItems(content, channel) {
const data = JSON.parse(content)
if (data.status !== 'OK') return []
return data.data.schedule[channel.site_id]
}