UNPKG

@phunky/scrape-channel-listings

Version:

A TypeScript library for scraping TV channel listings from various providers

29 lines (28 loc) 1.01 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const scrapeFunction = async (page) => { return await page.$$eval('table tbody tr', (rows) => { return rows.map((row) => { // Skip any In Wales kinda channels if ((row.querySelector('.column-3')?.textContent || '').startsWith('In')) { return {}; } const number = row.querySelector('.column-1')?.textContent || ''; const name = row.querySelector('.column-2')?.textContent || ''; return { number, name }; }); }); }; const overrides = { 'TNT SPORTS ULTIMATE': 'TNT Ultimate', 'ITV1/STV/UTV': 'ITV1', 'SKY CINEMA SCI-FI & HORROR HD': 'SKY CINEMA SCFI/HORROR', }; const config = { url: 'https://rxtvinfo.com/virgin-media-channel-list-uk/', scrapeFunction, overrides, excludeChannels: (channel) => !channel.name || channel.number.includes('-'), outputFile: 'virgin.json' }; exports.default = config;