Added guide from andorradifusio.ad

This commit is contained in:
freearhey 2021-04-24 20:29:06 +03:00
parent fa65a60aed
commit 7f6bc90ec3
4 changed files with 75 additions and 0 deletions

View file

@ -4,6 +4,23 @@ on:
schedule:
- cron: '0 0 * * *'
jobs:
andorradifusio_ad:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Install Dependencies
run: npm install
- name: Run EPG Grabber
run: npx epg-grabber --config=sites/andorradifusio.ad.config.js
- name: Deploy to GitHub Pages
uses: JamesIves/github-pages-deploy-action@4.1.1
with:
branch: gh-pages
folder: .gh-pages
clean: false
znbc_co_zm:
runs-on: ubuntu-latest
steps:

View file

@ -12,6 +12,7 @@ To load a program guide, all you need to do is copy the link to one of the guide
</thead>
<tbody>
<tr><td align="left" nowrap>🇦🇱 Albania</td><td align="left" nowrap><code>https://iptv-org.github.io/epg/guides/albepg.com.guide.xml</code></td></tr>
<tr><td align="left" nowrap>🇦🇩 Andorra</td><td align="left" nowrap><code>https://iptv-org.github.io/epg/guides/andorradifusio.ad.guide.xml</code></td></tr>
<tr><td align="left" nowrap>🇦🇷 Argentina</td><td align="left" nowrap><code>https://iptv-org.github.io/epg/guides/mi.tv.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>🇧🇾 Belarus</td><td align="left" nowrap><code>https://iptv-org.github.io/epg/guides/tv.yandex.ru.guide.xml</code></td></tr>

View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<site site="andorradifusio.ad">
<channels>
<channel site_id="atv" xmltv_id="ATV.ad">ATV</channel>
</channels>
</site>

View file

@ -0,0 +1,51 @@
const jsdom = require('jsdom')
const { JSDOM } = jsdom
const dayjs = require('dayjs')
const utc = require('dayjs/plugin/utc')
const customParseFormat = require('dayjs/plugin/customParseFormat')
dayjs.extend(utc)
dayjs.extend(customParseFormat)
module.exports = {
lang: 'ca',
site: 'andorradifusio.ad',
channels: 'andorradifusio.ad.channels.xml',
output: '.gh-pages/guides/andorradifusio.ad.guide.xml',
url({ channel }) {
return `https://www.andorradifusio.ad/programacio/${channel.site_id}`
},
parser({ content, date }) {
const day = date.day() - 1
const programs = []
const dom = new JSDOM(content)
const cols = dom.window.document.querySelectorAll('.programacio-dia')
const colNum = day < 0 ? 6 : day
const times = cols[colNum].querySelectorAll(`h4`)
const titles = cols[colNum].querySelectorAll(`p`)
times.forEach((time, i) => {
const title = titles[i] ? titles[i].textContent : null
if (!time || !title) return false
const start = dayjs
.utc(time.textContent, 'HH:mm')
.set('D', date.get('D'))
.set('M', date.get('M'))
.set('y', date.get('y'))
if (!start.isValid()) return false
if (programs.length && !programs[programs.length - 1].stop) {
programs[programs.length - 1].stop = start
}
programs.push({
title,
start
})
})
return programs
}
}