diff --git a/.github/workflows/auto-update.yml b/.github/workflows/auto-update.yml
index 90a04a6a..f709c674 100644
--- a/.github/workflows/auto-update.yml
+++ b/.github/workflows/auto-update.yml
@@ -34,6 +34,7 @@ jobs:
programetv.ro,
programme-tv.net,
programtv.onet.pl,
+ rev.bs,
telkussa.fi,
tv.cctv.com,
tv.lv,
diff --git a/README.md b/README.md
index 32151516..1c671d68 100644
--- a/README.md
+++ b/README.md
@@ -30,6 +30,7 @@ To load a program guide, all you need to do is copy the link to one or more of t
🇦🇺 Australia | https://iptv-org.github.io/epg/guides/ontvtonight.com.guide.xml |
🇦🇹 Austria | https://iptv-org.github.io/epg/guides/hd-plus.de.guide.xml |
🇦🇿 Azerbaijan | https://iptv-org.github.io/epg/guides/tv.mail.ru.guide.xml |
+ 🇧🇸 Bahamas | https://iptv-org.github.io/epg/guides/rev.bs.guide.xml |
🇧🇾 Belarus | https://iptv-org.github.io/epg/guides/tv.mail.ru.guide.xml |
🇧🇯 Benin | https://iptv-org.github.io/epg/guides/dstv.com.guide.xml |
🇧🇴 Bolivia | https://iptv-org.github.io/epg/guides/comteco.com.bo.guide.xml |
diff --git a/package-lock.json b/package-lock.json
index eeba44dd..bd0ded38 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -16,6 +16,7 @@
"html-to-text": "^7.0.0",
"iconv-lite": "^0.4.24",
"jsdom": "^16.5.0",
+ "lodash": "^4.17.21",
"parse-duration": "^1.0.0",
"tabletojson": "^2.0.7",
"xml-js": "^1.6.11"
diff --git a/package.json b/package.json
index 30ce9d2b..434ab566 100644
--- a/package.json
+++ b/package.json
@@ -16,6 +16,7 @@
"html-to-text": "^7.0.0",
"iconv-lite": "^0.4.24",
"jsdom": "^16.5.0",
+ "lodash": "^4.17.21",
"parse-duration": "^1.0.0",
"tabletojson": "^2.0.7",
"xml-js": "^1.6.11"
diff --git a/sites/rev.bs.channels.xml b/sites/rev.bs.channels.xml
new file mode 100755
index 00000000..6677abec
--- /dev/null
+++ b/sites/rev.bs.channels.xml
@@ -0,0 +1,9 @@
+
+
+
+ ZNS TV
+ Our TV
+ JCN Channel 14
+ Island Luck TV
+
+
\ No newline at end of file
diff --git a/sites/rev.bs.config.js b/sites/rev.bs.config.js
new file mode 100644
index 00000000..1f62790d
--- /dev/null
+++ b/sites/rev.bs.config.js
@@ -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]
+}