Merge pull request #1032 from iptv-org/add-tv24.co.uk

Add guide from tv24.co.uk
This commit is contained in:
Aleksandr Statciuk authored and GitHub committed 2022-08-27 20:03:56 +03:00
commit 07ba6572e0
5 files changed
+274

No files matched your search

+17
View File
@@ -0,0 +1,17 @@
name: tv24.co.uk
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 }}
+1
View File
@@ -0,0 +1 @@
<ul class="section-items t12 "><li><a href="/b/rhb7gc-d8i" class="program"><span class="time">5:05am</span><div class="meta"><h3>Gardeners' World</h3><p>Arit Anderson discovers a paradise garden in Cambridge which has become a focal point for the local community, and Frances Tophill shares the joy of collecting and saving heirloom vegetable seeds on a visit to Pembrokeshire.</p></div></a></li><li><a href="/b/rhba8c-d8i" class="program"><span class="time">6:05am</span><div class="meta"><h3>Countryfile</h3><span class="desc">Surrey Hills</span><p>Just a few miles from London, Matt Baker and Charlotte Smith revel in the serenity and beauty of the Surrey Hills, a landscape that was home to one of Britain's best-loved composers, Ralph Vaughan Williams. This year marks the 150th anniversary of his birth, and world-renowned violinist Pekka Kuusisto treats us to a very special performance of The Lark Ascending.</p></div></a></li><li><a href="/b/rhbcs0-d8i" class="program"><span class="time">7:00am</span><div class="meta"><h3>Beechgrove</h3><span class="desc">Series 4 Episode 21</span><p>Earlier in the season, Carole Baxter was joined by tomato grower Camilla Fredriksen to plant a number of varieties both indoors and outdoors, and the pair return to Beechgrove to see how those plants have progressed.</p></div></a></li><li><a href="/b/rhbe60-d8i" class="program"><span class="time">7:30am</span><div class="meta"><h3>Weatherman Walking</h3><span class="desc">Series 12 Episode 6: Trellech to Abergavenny</span><p>Weatherman Derek Brockway explores the stunning Wye Valley on a walk which takes him from the ancient village of Trellech to the stunning market town of Monmouth. On the way he takes a dip in `Britain's favourite river', the Wye, and follows in the footsteps of Admiral Nelson. Meanwhile history hunter Dr Erin Lloyd Jones joins the search for a lost city and Matthew Bassett forages the woods and hedgerows for some edible delights.</p></div></a></li><li><a href="/b/rhbfk0-d8i" class="program"><span class="time">8:00am</span><div class="meta"><h3>Coast: The Great Guide</h3><span class="desc">Series 1 Episode 2: Southern Wales</span><p>Tessa Dunlop and Neil Oliver present an insider guide to Southern Wales - from the Severn Bridge to St Davids - as they unearth the stories that give this coast its wild appeal. Building on the best of ten years of `Coast' stories from these shores, Tessa takes to the seas to seek out new stories and extreme experiences for the guide.</p></div></a></li><li><a href="/b/rhbic0-d8i" class="program"><span class="time">9:00am</span><div class="meta"><h3>Saturday Kitchen Best Bites</h3><p>Matt Tebbutt takes a look back at some of his favourite recipes and best moments from Saturday Kitchen.</p></div></a></li><li><a href="/b/rhbmi0-d8i" class="program"><span class="time">10:30am</span><div class="meta"><h3>A Cook Abroad</h3><span class="desc">Series 1 Episode 2: Tony Singh's India</span><p>Scottish chef, Tony Singh travels to India - the country of his ancestors - to trace his family roots and discover whether his Mum's Punjabi cooking is the real deal. He begins his journey in Amritsar before braving the Grand Trunk Road to Delhi.</p></div></a></li><li><a href="/b/rhbpa0-d8i" class="program"><span class="time">11:30am</span><div class="meta"><h3>Recipes That Made Me</h3><span class="desc">Series 1 Episode 1: Punjab</span><p>Nisha travels to the West Midlands, which has the largest population of Punjabis living in the UK, to discover all she can about Punjabi food from the North of India. Punjabi cuisine is famous for its rich dishes and she wants to understand more about the ingredients, cooking techniques and culture that has given this cuisine its unique characteristics.</p></div></a></li><li><a href="/b/rhbqo0-d8i" class="program"><span class="time">12:00pm</span><div class="meta"><h3>Nigel Slater's Dish of the Day</h3><p></p></div></a></li><li><a href="/b/rhbrlc-d8i" class="program"><span class="time">12:20pm</span><div class="meta"><h3>The Great British Countryside</h3><span class="desc">Series 1 Episode 1: Cornwall and Devon</span><p>Hugh Dennis and Julia Bradbury venture across the most stunning parts of Cornwall and Devon to discover how Britain's epic past lives on in the most fascinating stories and characters. Hugh experiences the full force of the Atlantic as he leaps from a sharp granite clifftop into a lashing sea - his first taste of coasteering. He also attempts to land on Britain's scariest helipad at the top of a lighthouse.</p></div></a></li><li><a href="/b/rhbudc-d8i" class="program"><span class="time">1:20pm</span><div class="meta"><h3><img src="/images/icons/ic_movie_26.png" width="13" height="11" class="movie"> The Train</h3><span class="desc">Thriller (1965)</span><p>A true story of wartime heroism about a French railway inspector who goes up against the Nazis in order to prevent a trainload of France's most treasured paintings from being stolen.</p></div></a></li><Line truncated
+91
View File
@@ -0,0 +1,91 @@
const dayjs = require('dayjs')
const axios = require('axios')
const cheerio = require('cheerio')
const utc = require('dayjs/plugin/utc')
const customParseFormat = require('dayjs/plugin/customParseFormat')
dayjs.extend(utc)
dayjs.extend(customParseFormat)
module.exports = {
site: 'tv24.co.uk',
url: function ({ channel, date }) {
return `https://tv24.co.uk/x/channel/${channel.site_id}/0/${date.format('YYYY-MM-DD')}`
},
parser: function ({ content, date }) {
let programs = []
const items = parseItems(content)
items.forEach(item => {
const prev = programs[programs.length - 1]
const $item = cheerio.load(item)
let start = parseStart($item, date)
if (prev) {
if (start.isBefore(prev.start)) {
start = start.add(1, 'd')
date = date.add(1, 'd')
}
prev.stop = start
}
const stop = start.add(30, 'm')
programs.push({
title: parseTitle($item),
description: parseDescription($item),
start,
stop
})
})
return programs
},
async channels() {
let html = await axios
.get(`https://tv24.co.uk/x/settings/addremove`)
.then(r => r.data)
.catch(console.log)
let $ = cheerio.load(html)
const nums = $('li')
.toArray()
.map(item => $(item).data('channel'))
html = await axios
.get(`https://tv24.co.uk`, {
headers: {
Cookie: `selectedChannels=${nums.join(',')}`
}
})
.then(r => r.data)
.catch(console.log)
$ = cheerio.load(html)
const items = $('li.c').toArray()
return items.map(item => {
const name = $(item).find('h3').text().trim()
const link = $(item).find('.channel').attr('href')
const [_, site_id] = link.match(/\/channel\/(.*)/) || [null, null]
return {
site_id,
name
}
})
}
}
function parseTitle($item) {
return $item('h3').text()
}
function parseDescription($item) {
return $item('p').text()
}
function parseStart($item, date) {
const time = $item('.time').text()
return dayjs.utc(`${date.format('YYYY-MM-DD')} ${time}`, 'YYYY-MM-DD h:mma')
}
function parseItems(content) {
const $ = cheerio.load(content)
return $('.program').toArray()
}
+53
View File
@@ -0,0 +1,53 @@
// npm run channels:parse -- --config=./sites/tv24.co.uk/tv24.co.uk.config.js --output=./sites/tv24.co.uk/tv24.co.uk_uk.channels.xml
// npx epg-grabber --config=sites/tv24.co.uk/tv24.co.uk.config.js --channels=sites/tv24.co.uk/tv24.co.uk_uk.channels.xml --output=guide.xml --days=2
const { parser, url } = require('./tv24.co.uk.config.js')
const fs = require('fs')
const path = require('path')
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-08-28', 'YYYY-MM-DD').startOf('d')
const channel = {
site_id: 'bbc-two',
xmltv_id: 'BBCTwo.uk'
}
it('can generate valid url', () => {
expect(url({ channel, date })).toBe('https://tv24.co.uk/x/channel/bbc-two/0/2022-08-28')
})
it('can parse response', () => {
const content = fs.readFileSync(path.resolve(__dirname, '__data__/content.html'))
const results = parser({ content, date }).map(p => {
p.start = p.start.toJSON()
p.stop = p.stop.toJSON()
return p
})
expect(results[0]).toMatchObject({
start: '2022-08-28T05:05:00.000Z',
stop: '2022-08-28T06:05:00.000Z',
title: "Gardeners' World",
description:
'Arit Anderson discovers a paradise garden in Cambridge which has become a focal point for the local community, and Frances Tophill shares the joy of collecting and saving heirloom vegetable seeds on a visit to Pembrokeshire.'
})
expect(results[22]).toMatchObject({
start: '2022-08-29T05:30:00.000Z',
stop: '2022-08-29T06:00:00.000Z',
title: 'Animal Park',
description:
"One of the park's vultures has laid an egg. It is ten years since Longleat had a successfully reared vulture chick, so the keepers send Hamza to find out if the parents are incubating their egg."
})
})
it('can handle empty guide', () => {
const result = parser({
content: ''
})
expect(result).toMatchObject([])
})
+112
View File
@@ -0,0 +1,112 @@
<?xml version="1.0" encoding="UTF-8"?>
<site site="tv24.co.uk">
<channels>
<channel lang="en" xmltv_id="4Seven.uk" site_id="4seven">4Seven</channel>
<channel lang="en" xmltv_id="5Action.uk" site_id="5-action-1">5 Action</channel>
<channel lang="en" xmltv_id="5Select.uk" site_id="5select">5SELECT</channel>
<channel lang="en" xmltv_id="5USA.uk" site_id="5usa">5USA</channel>
<channel lang="en" xmltv_id="Alarabiya.ae" site_id="al-arabiya">Al Arabiya</channel>
<channel lang="en" xmltv_id="AlJazeeraEnglish.qa" site_id="al-jazeera-english">Al Jazeera English</channel>
<channel lang="en" xmltv_id="AriseNews.uk" site_id="arise">ARISE</channel>
<channel lang="en" xmltv_id="Babestation.uk" site_id="babestation-1">Babestation</channel>
<channel lang="en" xmltv_id="BBCFour.uk" site_id="bbc-four">BBC Four</channel>
<channel lang="en" xmltv_id="BBCFourHD.uk" site_id="bbc-four-hd">BBC Four HD</channel>
<channel lang="en" xmltv_id="BBCNews.uk" site_id="bbc-news">BBC News</channel>
<channel lang="en" xmltv_id="BBCOneHD.uk" site_id="bbc-one-hd-england">BBC One HD (England)</channel>
<channel lang="en" xmltv_id="BBCOneLondon.uk" site_id="bbc-one-london">BBC One London</channel>
<channel lang="en" xmltv_id="BBCParliament.uk" site_id="bbc-parliament">BBC Parliament</channel>
<channel lang="en" xmltv_id="BBCRedButton1.uk" site_id="bbc-red-button-1">BBC Red Button 1</channel>
<channel lang="en" xmltv_id="BBCThree.uk" site_id="bbc-three">BBC Three</channel>
<channel lang="en" xmltv_id="BBCTwo.uk" site_id="bbc-two">BBC Two</channel>
<channel lang="en" xmltv_id="BBCTwoHD.uk" site_id="bbc-two-hd">BBC Two HD</channel>
<channel lang="en" xmltv_id="CBBC.uk" site_id="cbbc">CBBC</channel>
<channel lang="en" xmltv_id="CBeebiesUK.uk" site_id="cbeebies">CBeebies</channel>
<channel lang="en" xmltv_id="CBSRealityUK.uk" site_id="cbs-reality">CBS Reality</channel>
<channel lang="en" xmltv_id="ChallengeUK.uk" site_id="challenge-tv">Challenge TV</channel>
<channel lang="en" xmltv_id="Channel4.uk" site_id="channel-4">Channel 4</channel>
<channel lang="en" xmltv_id="Channel4LondonPlus1.uk" site_id="channel-4-1">Channel 4 +1</channel>
<channel lang="en" xmltv_id="Channel5.uk" site_id="channel-5">Channel 5</channel>
<channel lang="en" xmltv_id="Channel5Plus1.uk" site_id="channel-5-1">Channel 5+1</channel>
<channel lang="en" xmltv_id="CreateandCraft.uk" site_id="create-and-craft-freeview">Create and Craft (Freeview)</channel>
<channel lang="en" xmltv_id="Davejavu.uk" site_id="dave-ja-vu">Dave Ja Vu</channel>
<channel lang="en" xmltv_id="DaveUK.uk" site_id="dave">Dave</channel>
<channel lang="en" xmltv_id="DMAXUK.uk" site_id="dmax">DMAX</channel>
<channel lang="en" xmltv_id="DramaUK.uk" site_id="drama">Drama</channel>
<channel lang="en" xmltv_id="E4UK.uk" site_id="e4">E4</channel>
<channel lang="en" xmltv_id="Film4UK.uk" site_id="film4">Film4</channel>
<channel lang="en" xmltv_id="FoodNetworkUK.uk" site_id="food-network">Food Network</channel>
<channel lang="en" xmltv_id="GBNews.uk" site_id="gb-news">GB News</channel>
<channel lang="en" xmltv_id="HGTVUK.uk" site_id="hgtv">HGTV</channel>
<channel lang="en" xmltv_id="IdealWorld.uk" site_id="ideal-world-freeview">Ideal World (Freeview)</channel>
<channel lang="en" xmltv_id="ITV2.uk" site_id="itv2">ITV2</channel>
<channel lang="en" xmltv_id="ITV3.uk" site_id="itv3">ITV3</channel>
<channel lang="en" xmltv_id="ITV4.uk" site_id="itv4">ITV4</channel>
<channel lang="en" xmltv_id="ITVBe.uk" site_id="itv-be">ITV BE</channel>
<channel lang="en" xmltv_id="KissTV.uk" site_id="kiss">Kiss</channel>
<channel lang="en" xmltv_id="LondonLive.uk" site_id="london-live">London Live</channel>
<channel lang="en" xmltv_id="More4UK.uk" site_id="more-4">More 4</channel>
<channel lang="en" xmltv_id="PlanetKnowledge.uk" site_id="planet-knowledge">Planet Knowledge</channel>
<channel lang="en" xmltv_id="Pop.uk" site_id="pop">Pop</channel>
<channel lang="en" xmltv_id="QuestRedUK.uk" site_id="quest-red">Quest Red</channel>
<channel lang="en" xmltv_id="QuestRedUKPlus1.uk" site_id="quest-red-1">Quest Red +1</channel>
<channel lang="en" xmltv_id="QuestUK.uk" site_id="quest">Quest</channel>
<channel lang="en" xmltv_id="QVCStyleUK.uk" site_id="qvc-style-freeview">QVC Style (Freeview)</channel>
<channel lang="en" xmltv_id="ReallyUK.uk" site_id="really-uktv">Really</channel>
<channel lang="en" xmltv_id="SkyArts.uk" site_id="sky-arts">Sky Arts</channel>
<channel lang="en" xmltv_id="SkyNews.uk" site_id="sky-news">Sky News</channel>
<channel lang="en" xmltv_id="SmithsonianChannelUK.uk" site_id="smithsonian-channel-sd">Smithsonian Channel SD</channel>
<channel lang="en" xmltv_id="TalkingPicturesTV.uk" site_id="talking-pictures-tv">Talking Pictures TV</channel>
<channel lang="en" xmltv_id="TBNUK.uk" site_id="tbn-uk">TBN UK</channel>
<channel lang="en" xmltv_id="TogetherTV.uk" site_id="together">Together</channel>
<channel lang="en" xmltv_id="XpandedTV.uk" site_id="xxxpanded-tv">xxXpanded TV</channel>
<channel lang="en" xmltv_id="Yesterday.uk" site_id="yesterday">Yesterday</channel>
<channel lang="en" xmltv_id="YesterdayPlus1.uk" site_id="yesterday-1">Yesterday +1</channel>
<!-- <channel lang="en" xmltv_id="" site_id="5-star">5*</channel> -->
<!-- <channel lang="en" xmltv_id="" site_id="adult-section">Adult Section</channel> -->
<!-- <channel lang="en" xmltv_id="" site_id="asharq-news-hd">Asharq News HD</channel> -->
<!-- <channel lang="en" xmltv_id="" site_id="bbc-three-hd">BBC Three HD</channel> -->
<!-- <channel lang="en" xmltv_id="" site_id="blaze-1-freeview">Blaze +1 (Freeview)</channel> -->
<!-- <channel lang="en" xmltv_id="" site_id="blaze-freeview">Blaze (Freeview)</channel> -->
<!-- <channel lang="en" xmltv_id="" site_id="cbbc-hd">CBBC HD</channel> -->
<!-- <channel lang="en" xmltv_id="" site_id="cbeebies-hd">CBeebies HD</channel> -->
<!-- <channel lang="en" xmltv_id="" site_id="celebration-tv">Celebration TV</channel> -->
<!-- <channel lang="en" xmltv_id="" site_id="channel-4-hd">Channel 4 HD</channel> -->
<!-- <channel lang="en" xmltv_id="" site_id="channel-5-hd">Channel 5 HD</channel> -->
<!-- <channel lang="en" xmltv_id="" site_id="childrens-itv">Children&apos;s ITV</channel> -->
<!-- <channel lang="en" xmltv_id="" site_id="classic-hits">Classic Hits</channel> -->
<!-- <channel lang="en" xmltv_id="" site_id="drama-1">Drama +1</channel> -->
<!-- <channel lang="en" xmltv_id="" site_id="e4-1">E4 +1</channel> -->
<!-- <channel lang="en" xmltv_id="" site_id="e4-extra">E4 Extra</channel> -->
<!-- <channel lang="en" xmltv_id="" site_id="film4-1">Film4 +1</channel> -->
<!-- <channel lang="en" xmltv_id="" site_id="freeview-information">Freeview Information</channel> -->
<!-- <channel lang="en" xmltv_id="" site_id="gems-tv-freeview">Gems TV (Freeview)</channel> -->
<!-- <channel lang="en" xmltv_id="" site_id="great-movies">Great Movies</channel> -->
<!-- <channel lang="en" xmltv_id="" site_id="great-movies-1">Great Movies +1</channel> -->
<!-- <channel lang="en" xmltv_id="" site_id="great-movies-action">Great Movies Action</channel> -->
<!-- <channel lang="en" xmltv_id="" site_id="great-movies-classic">Great Movies Classic</channel> -->
<!-- <channel lang="en" xmltv_id="" site_id="great-tv">Great TV</channel> -->
<!-- <channel lang="en" xmltv_id="" site_id="itv-1">ITV +1</channel> -->
<!-- <channel lang="en" xmltv_id="" site_id="itv1-hd-london">ITV1 London HD</channel> -->
<!-- <channel lang="en" xmltv_id="" site_id="itv1-london">ITV1 London</channel> -->
<!-- <channel lang="en" xmltv_id="" site_id="itv2-1-freeview">ITV2 +1 (Freeview)</channel> -->
<!-- <channel lang="en" xmltv_id="" site_id="itv3-freeview-1">ITV3 Freeview +1</channel> -->
<!-- <channel lang="en" xmltv_id="" site_id="itv4-1-freeview">ITV4 +1 (Freeview)</channel> -->
<!-- <channel lang="en" xmltv_id="" site_id="itvbe-1-freeview">ITVBe +1 (Freeview)</channel> -->
<!-- <channel lang="en" xmltv_id="" site_id="ketchup-tv">Ketchup TV</channel> -->
<!-- <channel lang="en" xmltv_id="" site_id="legend">Legend</channel> -->
<!-- <channel lang="en" xmltv_id="" site_id="pbs">PBS</channel> -->
<!-- <channel lang="en" xmltv_id="" site_id="pick-tv">Pick TV</channel> -->
<!-- <channel lang="en" xmltv_id="" site_id="quest-1">Quest +1</channel> -->
<!-- <channel lang="en" xmltv_id="" site_id="qvc-uk">QVC (UK)</channel> -->
<!-- <channel lang="en" xmltv_id="" site_id="realityxtra-freeview">RealityXtra (Freeview)</channel> -->
<!-- <channel lang="en" xmltv_id="" site_id="shopping-quarter">Shopping Quarter</channel> -->
<!-- <channel lang="en" xmltv_id="" site_id="smile-tv3">Smile TV3</channel> -->
<!-- <channel lang="en" xmltv_id="" site_id="sonlife-broadcasting-network">SonLife Broadcasting Network</channel> -->
<!-- <channel lang="en" xmltv_id="" site_id="talk-tv-hd">Talk TV HD</channel> -->
<!-- <channel lang="en" xmltv_id="" site_id="tcc">TCC</channel> -->
<!-- <channel lang="en" xmltv_id="" site_id="thats-tv">That&apos;s TV</channel> -->
<!-- <channel lang="en" xmltv_id="" site_id="tiny-pop-freeview">Tiny Pop (Freeview)</channel> -->
<!-- <channel lang="en" xmltv_id="" site_id="vision-tv">Vision TV</channel> -->
<!-- <channel lang="en" xmltv_id="" site_id="w">W</channel> -->
</channels>
</site>