UNPKG

@phunky/scrape-channel-listings

Version:

A TypeScript library for scraping TV channel listings from various providers

52 lines (51 loc) 1.72 kB
"use strict"; /** * Sky Satellite Channel Listing Scraper * Extracts channel numbers and names from Sky Q or Sky+HD channel lineup */ Object.defineProperty(exports, "__esModule", { value: true }); const scraper_1 = require("../utils/scraper"); /** * Extracts channel information from the Sky channel listing page * @param page - Playwright page instance * @returns Array of partial channel objects containing number and name */ const scrapeFunction = async (page) => { return await page.$$eval('table tbody tr', (rows) => { return rows.map((row) => { const number = row.querySelector('.column-1')?.textContent?.trim() || ''; const name = row.querySelector('.column-2')?.textContent?.trim() || ''; // Skip those with dashes in numbers as these are category definitions if (!name || !number || number.includes('-')) { return {}; } return { number, name }; }); }); }; /** * Channel name overrides to standardize naming across providers */ const overrides = { 'Sky Cinema Sci-Fi/Horror HD': 'SKY CINEMA SCFI/HORROR HD', 'RTÉ One HD': 'RTE One', 'RTÉ 2 HD': 'RTE 2', 'RTÉjr': 'RTE Junior', 'RTÉ News': 'RTE News', 'Sky Sports UHD 1': 'Sky Sports 1 UHD', 'Sky Sports UHD 2': 'Sky Sports 2 UHD ', }; /** * Sky UK scraper configuration */ const config = { url: 'https://rxtvinfo.com/sky-satellite-channel-list-uk/', scrapeFunction, overrides, outputFile: 'sky-ireland.json' }; // Run scraper if this file is executed directly if (require.main === module) { (0, scraper_1.runScraperCLI)(config).catch(() => process.exit(1)); } exports.default = config;