@phunky/scrape-channel-listings
Version:
A TypeScript library for scraping TV channel listings from various providers
33 lines (32 loc) • 1.1 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const scrapeFunction = async (page) => {
return await page.$$eval('table tbody tr', (rows) => {
return rows.map((row) => {
const number = row.querySelector('.column-1')?.textContent || '';
const name = row.querySelector('.column-2')?.textContent || '';
return { number, name };
});
});
};
const overrides = {
'DISC. SCIENCE': 'Discovery Science',
'DISC. TURBO': 'Discovery Turbo',
'SKY CINEMA SCI-FI/HORROR': 'SKY CINEMA SCFI/HORROR',
'RTÉjr': 'RTE Junior',
};
const config = {
url: 'https://rxtvinfo.com/sky-channel-list-uk/',
scrapeFunction,
overrides,
excludeChannels: (channel) => {
const num = parseInt(channel.number);
return !channel.name ||
channel.number.includes('-') ||
num >= 800 || // SD SWAPS
(num >= 640 && num <= 645) || // SD SWAPS
channel.number.startsWith('01'); // radio channels
},
outputFile: 'sky.json'
};
exports.default = config;