From 393ab713e5f5bf040cc520c52ad5ae8bbd2556ce Mon Sep 17 00:00:00 2001 From: freearhey <7253922+freearhey@users.noreply.github.com> Date: Thu, 30 Nov 2023 21:23:01 +0300 Subject: [PATCH] Update tv.nu --- sites/tv.nu/readme.md | 21 ++++++ sites/tv.nu/tv.nu.channels.xml | 116 ++++++++++++++++++++------------- sites/tv.nu/tv.nu.config.js | 37 +++++++++++ sites/tv.nu/tv.nu.test.js | 2 - 4 files changed, 127 insertions(+), 49 deletions(-) create mode 100644 sites/tv.nu/readme.md diff --git a/sites/tv.nu/readme.md b/sites/tv.nu/readme.md new file mode 100644 index 00000000..152a85e4 --- /dev/null +++ b/sites/tv.nu/readme.md @@ -0,0 +1,21 @@ +# tv.nu + +https://www.tv.nu/alla-kanaler + +### Download the guide + +```sh +npm run grab -- --site=tv.nu +``` + +### Update channel list + +```sh +npm run channels:parse -- --config=./sites/tv.nu/tv.nu.config.js --output=./sites/tv.nu/tv.nu.channels.xml +``` + +### Test + +```sh +npm test -- tv.nu +``` diff --git a/sites/tv.nu/tv.nu.channels.xml b/sites/tv.nu/tv.nu.channels.xml index 62e295fd..b0771626 100644 --- a/sites/tv.nu/tv.nu.channels.xml +++ b/sites/tv.nu/tv.nu.channels.xml @@ -1,39 +1,36 @@ + 3sat - Adult Channel (UK) + Adult Channel Al Jazeera English Animal Planet ARTE ATG Live Axess TV - BBC Brit BBC Earth - BBC World News - Bloomberg TV HD - Boomerang + BBC Nordic BraZZers TV Plus + Cartoonito Cartoon Network - CBS Reality China Global Television Network 9 Documentary - China Global Television Network (Europe) + China Global Television Network Club MTV - C More First - C More Fotboll - C More Mix - C More Hits - C More Hockey - C More Live - C More Live 2 - C More Live 3 - C More Live 4 - C More Live 5 - C More Mix - C More Series - C More Stars CNBC - CNN - Curiosity Stream Channel + CNN International + CuriosityStream Das Erste Discovery Channel Discovery+ Extra 1 @@ -47,13 +44,19 @@ Discovery Science Disney Channel Disney Junior + DK4 + DK4 HD DMAX DR1 DR2 + DR3 + DR K DR Ramasjang - DW + DR Ultra + DW en alemán E! eSportsone + eSportsTV HD Euro News Eurosport 1 Eurosport 2 @@ -62,34 +65,39 @@ FTV Fight Sports France 2 - France 24 English HD - FULE TV - GINX eSports TV + France 24 English HD + FUEL TV + GINX eSports TV Godare GOD TV + High TV 3D H2 - Histrory HD + History HD Horse & Country TV HRT1 Hustler TV Investigation Discovery Kanal 10 Kanal 11 - Kanal 4 Danmark + Kanal 4 Kanal 5 Danmark Kanal 5 Kanal 9 Kunskapskanalen + Love Nature 4K UHD Mezzo - Mezzo Live HD + Mezzo Live Motorvision TV + Motorvision TV (DE) MTV3 - MTV 90s + MTV 80s + MTV 90s + MTV Aitio MTV MTV Hits MTV Live HD + MTV Viihde National Geographic - National Geographic HD (UK) National Geographic Wild Nautical Channel Nelonen @@ -101,28 +109,28 @@ NRK1 NRK2 NRK3 - Outdoor Channel HD + NRK Super / NRK3 HD OUTtv Paramount Network - Paramount+ Movies - Paramount+ Series + Penthouse HD 1 + Penthouse HD 2 Pink Plus Playboy TV Europe ProSieben Rai 1 Rai 2 RTL + Super RTL RTLZWEI + SF-Kanalen SF Kanalen Sjuan - Histrory (UK) + History (UK) Sky News - Sky Showtime 1 - Sky Showtime 2 - Sportkanalen - Stingray Classica + SkyShowtime 1 + SkyShowtime 2 + Stingray Classica Djazz HD - Super RTL SVT1 SVT2 SVT24 @@ -133,26 +141,41 @@ TV10 TV12 TV2 - TV2 - TV3 + TV2 (Norge) TV3 Danmark TV3 Norge + TV3 3 Plus Danmark + TV3+ TV4 TV4 Fakta TV4 Film + TV4 Fotboll TV4 Guld + TV4 Hits + TV4 Hockey + TV4 Motor + TV4 Sportkanalen + TV4 Sport Live 1 + TV4 Sport Live 2 + TV4 Sport Live 3 + TV4 Sport Live 4 + TV4 Stars + TV4 Tennis + TV5 HD TV5 Monde Europe TV6 TV8 - TV Chile Internacional + TV Chile TVE Internacional - TV Polonia + TV Finland + TV Norge HD + TVP Polonia + Vision Sverige V Film Action V Film Family V Film Hits V Film Premiere - VH1 Viasat Explore Viasat History Viasat Nature @@ -161,9 +184,8 @@ V Series V Sport 1 V Sport Extra - V Sport Fotball + V Sport Football V Sport Golf - V Sport Hockey V Sport Live 1 V Sport Live 2 V Sport Live 3 diff --git a/sites/tv.nu/tv.nu.config.js b/sites/tv.nu/tv.nu.config.js index a0c5d91e..99feceac 100644 --- a/sites/tv.nu/tv.nu.config.js +++ b/sites/tv.nu/tv.nu.config.js @@ -25,6 +25,43 @@ module.exports = { }) return programs + }, + async channels() { + const axios = require('axios') + + // prettier-ignore + const modules = [ 'ch-51', 'ch-52', 'ch-60', 'ch-27', 'ch-63', 'ch-65', 'ch-64', 'ch-66', 'ch-67', 'ch-68', 'ch-70', 'ch-88', 'ch-45', 'ch-132', 'ch-30228', 'ch-49', 'ch-53', 'ch-30233', 'ch-55', 'ch-93', 'ch-47', 'ch-4', 'ch-134', 'ch-105', 'ch-104', 'ch-131', 'ch-125', 'ch-126', 'ch-30215', 'ch-151', 'ch-122', 'ch-123', 'ch-124', 'ch-30194', 'ch-101', 'ch-106', 'ch-108', 'ch-107', 'ch-136', 'ch-137', 'ch-140', 'ch-120', 'ch-139', 'ch-74', 'ch-71', 'ch-76', 'ch-33', 'ch-18', 'ch-6', 'ch-30197', 'ch-30152', 'ch-146', 'ch-142', 'ch-128', 'ch-30211', 'ch-46', 'ch-162', 'ch-75', 'ch-119', 'ch-57', 'ch-82', 'ch-21', 'ch-22', 'ch-26', 'ch-145', 'ch-38', 'ch-10', 'ch-23', 'ch-9', 'ch-129', 'ch-69', 'ch-12', 'ch-3', 'ch-7', 'ch-81', 'ch-72', 'ch-2', 'ch-111', 'ch-16', 'ch-43', 'ch-80', 'ch-141', 'ch-143', 'ch-164', 'ch-147', 'ch-58', 'ch-39', 'ch-36', 'ch-15', 'ch-154', 'ch-40', 'ch-159', 'ch-30123', 'ch-30132', 'ch-30130', 'ch-30133', 'ch-30125', 'ch-30127', 'ch-30126', 'ch-30134', 'ch-30128', 'ch-30129', 'ch-30124', 'ch-30138', 'ch-30147', 'ch-30146', 'ch-30145', 'ch-30149', 'ch-30151', 'ch-30150', 'ch-30137', 'ch-30136', 'ch-30139', 'ch-30140', 'ch-30142', 'ch-30141', 'ch-161', 'ch-35', 'ch-34', 'ch-32', 'ch-30', 'ch-54', 'ch-112', 'ch-1', 'ch-86', 'ch-84', 'ch-28', 'ch-25', 'ch-13', 'ch-14', 'ch-11', 'ch-8', 'ch-5', 'ch-20', 'ch-24', 'ch-19', 'ch-30168', 'ch-30175', 'ch-30154', 'ch-30225', 'ch-30178', 'ch-30184', 'ch-30185', 'ch-30186', 'ch-30187', 'ch-30189', 'ch-30191', 'ch-30192', 'ch-30216', 'ch-30193', 'ch-30195', 'ch-30196', 'ch-30200', 'ch-30209', 'ch-30231', 'ch-30213', 'ch-30230', 'ch-30214', 'ch-30226', 'ch-56', 'ch-153', 'ch-148', 'ch-41', 'ch-37', 'ch-30157', 'ch-30158', 'ch-30232', 'ch-30221', 'ch-30222', 'ch-30223', 'ch-30234', 'ch-91', 'ch-100', 'ch-30235', 'ch-30236', 'ch-30237', 'ch-30239', 'ch-30240', 'ch-30241', 'ch-30242', 'ch-30249', 'ch-30256', 'ch-30253', 'ch-30250', 'ch-30257', 'ch-30255', 'ch-30251', 'ch-30252', 'ch-30254', 'ch-30258', 'ch-30259', 'ch-30260', 'ch-30261', 'ch-30262', 'ch-30263', 'ch-30264', 'ch-30265', 'ch-30372', 'ch-30373', 'ch-30374', 'ch-30375', 'ch-30376'] + + let channels = [] + + let offset = 0 + while (offset !== undefined) { + const data = await axios + .get(`https://web-api.tv.nu/tableauLinearChannels`, { + params: { + modules, + date: dayjs().format('YYYY-MM-DD'), + limit: 12, + offset + } + }) + .then(r => r.data) + .catch(console.error) + + console.log(data.data.nextOffset) + + data.data.modules.forEach(item => { + channels.push({ + lang: 'sv', + name: item.content.name, + site_id: item.content.slug + }) + }) + + offset = data.data.nextOffset + } + + return channels } } diff --git a/sites/tv.nu/tv.nu.test.js b/sites/tv.nu/tv.nu.test.js index 5170f29a..50ef8dcb 100644 --- a/sites/tv.nu/tv.nu.test.js +++ b/sites/tv.nu/tv.nu.test.js @@ -1,5 +1,3 @@ -// npm run grab -- --site=tv.nu - const { parser, url } = require('./tv.nu.config.js') const dayjs = require('dayjs') const utc = require('dayjs/plugin/utc')