From 21cc3319941194df1c2394a6060361719be6d90c Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Thu, 23 Sep 2021 12:22:52 +0300 Subject: [PATCH 1/4] Create arianaafgtv.com.config.js --- sites/arianaafgtv.com.config.js | 87 +++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 sites/arianaafgtv.com.config.js diff --git a/sites/arianaafgtv.com.config.js b/sites/arianaafgtv.com.config.js new file mode 100644 index 00000000..97079f11 --- /dev/null +++ b/sites/arianaafgtv.com.config.js @@ -0,0 +1,87 @@ +const cheerio = require('cheerio') +const dayjs = require('dayjs') +const utc = require('dayjs/plugin/utc') +const timezone = require('dayjs/plugin/timezone') +const customParseFormat = require('dayjs/plugin/customParseFormat') + +dayjs.extend(utc) +dayjs.extend(timezone) +dayjs.extend(customParseFormat) + +module.exports = { + lang: 'en', + days: 7, + site: 'arianaafgtv.com', + channels: 'arianaafgtv.com.channels.xml', + output: '.gh-pages/guides/arianaafgtv.com.guide.xml', + url() { + return `https://www.arianaafgtv.com/index.html` + }, + parser({ content, date }) { + const programs = [] + const items = parseItems(content, date) + items.forEach(item => { + const title = item.title + const start = parseStart(item, date) + const stop = parseStop(item, date) + programs.push({ + title, + start, + stop + }) + }) + + return programs + } +} + +function parseStop(item, date) { + const time = `${date.format('MM/DD/YYYY')} ${item.end.toUpperCase()}` + + return dayjs.tz(time, 'MM/DD/YYYY hh:mm A', 'Asia/Kabul') +} + +function parseStart(item, date) { + const time = `${date.format('MM/DD/YYYY')} ${item.start.toUpperCase()}` + + return dayjs.tz(time, 'MM/DD/YYYY hh:mm A', 'Asia/Kabul') +} + +function parseItems(content, date) { + const $ = cheerio.load(content) + const dayOfWeek = date.format('dddd') + const column = $('.H4') + .filter((i, el) => { + return $(el).text() === dayOfWeek + }) + .first() + .parent() + + const rows = column + .find('.Paragraph') + .map((i, el) => { + return $(el).html() + }) + .toArray() + .map(r => (r === ' ' ? '|' : r)) + .join(' ') + .split('|') + + const items = [] + rows.forEach(row => { + row = row.trim() + if (row) { + const found = row.match(/(\d+(|:\d+)(a|p)m-\d+(|:\d+)(a|p)m)/gi) + if (!found) return + const time = found[0] + let start = time.match(/(\d+(|:\d+)(a|p)m)-/i)[1] + start = dayjs(start.toUpperCase(), ['hh:mmA', 'h:mmA', 'hA']).format('hh:mm A') + let end = time.match(/-(\d+(|:\d+)(a|p)m)/i)[1] + end = dayjs(end.toUpperCase(), ['hh:mmA', 'h:mmA', 'hA']).format('hh:mm A') + const title = row.replace(time, '').replace(' ', '').trim() + items.push({ start, end, title }) + } + }) + + return items +} From bf0dccd4e8ec73a35272ed3430d1d9b36bc7ca4b Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Thu, 23 Sep 2021 12:22:56 +0300 Subject: [PATCH 2/4] Create arianaafgtv.com.channels.xml --- sites/arianaafgtv.com.channels.xml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100755 sites/arianaafgtv.com.channels.xml diff --git a/sites/arianaafgtv.com.channels.xml b/sites/arianaafgtv.com.channels.xml new file mode 100755 index 00000000..f9d910d0 --- /dev/null +++ b/sites/arianaafgtv.com.channels.xml @@ -0,0 +1,6 @@ + + + + Ariana Afghanistan International TV + + \ No newline at end of file From 3ae8c83d0fdaab3d0e5aef19a7447338c9bbd1bd Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Thu, 23 Sep 2021 12:23:00 +0300 Subject: [PATCH 3/4] Update auto-update.yml --- .github/workflows/auto-update.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/auto-update.yml b/.github/workflows/auto-update.yml index ac110da7..8199a0a7 100644 --- a/.github/workflows/auto-update.yml +++ b/.github/workflows/auto-update.yml @@ -13,6 +13,7 @@ jobs: site: [ andorradifusio.ad, + arianaafgtv.com, astro.com.my, comteco.com.bo, cosmote.gr, From 4ec46f9474b5409ac4a909592d226192b8dded7b Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Thu, 23 Sep 2021 18:12:58 +0300 Subject: [PATCH 4/4] Update README.md --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f3c51a24..9e214624 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,8 @@ To load a program guide, all you need to do is copy the link to one of the guide CountryEPG - 🇦🇫 Afghanistanhttps://iptv-org.github.io/epg/guides/arianatelevision.com.guide.xml + 🇦🇫 Afghanistanhttps://iptv-org.github.io/epg/guides/arianaafgtv.com.guide.xml + https://iptv-org.github.io/epg/guides/arianatelevision.com.guide.xml 🇩🇿 Algeriahttps://iptv-org.github.io/epg/guides/elcinema.com.guide.xml 🇦🇱 Albaniahttps://iptv-org.github.io/epg/guides/tvprofil.com.guide.xml 🇦🇩 Andorrahttps://iptv-org.github.io/epg/guides/andorradifusio.ad.guide.xml