UNPKG

@phunky/scrape-channel-listings

Version:

A TypeScript library for scraping TV channel listings from various providers

26 lines (25 loc) 841 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const scrapeFunction = async (page) => { return await page.$$eval('#dish-channel-guide tbody tr', (rows) => { return rows.map((row) => { const number = row.querySelector('td.column-2')?.textContent || ''; const name = row.querySelector('td.column-1')?.textContent || ''; if (!name || number.includes('-')) { return {}; } return { number, name }; }); }); }; const overrides = { 'NICK': 'NICKELODEON' }; const config = { url: 'https://www.allconnect.com/providers/dish/channel-guide', scrapeFunction, overrides, excludeChannels: (channel) => !channel.name || channel.number.includes('-'), outputFile: 'dish.json' }; exports.default = config;