From ba064254cd3a66904294c13d0ab8bafa66c9d9a7 Mon Sep 17 00:00:00 2001 From: freearhey <7253922+freearhey@users.noreply.github.com> Date: Sun, 19 Apr 2026 04:55:09 +0300 Subject: [PATCH 1/3] Update tvguide.com.test.js --- sites/tvguide.com/tvguide.com.test.js | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/sites/tvguide.com/tvguide.com.test.js b/sites/tvguide.com/tvguide.com.test.js index 52aa40b16..6a6f9459b 100644 --- a/sites/tvguide.com/tvguide.com.test.js +++ b/sites/tvguide.com/tvguide.com.test.js @@ -17,29 +17,19 @@ const channel = { } it('can generate valid url', async () => { - axios.get.mockImplementation(url => { - if (url === 'https://www.tvguide.com/listings/') { - return Promise.resolve({ - data: fs.readFileSync(path.join(__dirname, '__data__', 'content.html'), 'utf8') - }) - } - throw new Error(`Unexpected URL: ${url}`) - }) - const result = await url({ date }) expect(result).toBe( - 'https://backend.tvguide.com/tvschedules/tvguide/9100001138/web?start=1753747200&duration=240&apiKey=DI9elXhZ3bU6ujsA2gXEKOANyncXGUGc' + 'https://backend.tvguide.com/tvschedules/tvguide/9100001138/web?start=1753747200&duration=240' ) }) it('can parse response', async () => { - const content = JSON.parse(fs.readFileSync(path.join(__dirname, '__data__', 'content.json'), 'utf-8')) + const content = JSON.parse( + fs.readFileSync(path.join(__dirname, '__data__', 'content.json'), 'utf-8') + ) axios.get.mockImplementation(url => { - if ( - url === - 'https://backend.tvguide.com/tvschedules/tvguide/programdetails/9000058285/web' - ) { + if (url === 'https://backend.tvguide.com/tvschedules/tvguide/programdetails/9000058285/web') { return Promise.resolve({ data: JSON.parse(fs.readFileSync(path.join(__dirname, '__data__', 'program.json'))) }) @@ -61,10 +51,10 @@ it('can parse response', async () => { title: 'Secrets of the Zoo: North Carolina', sub_title: 'Chimp Off the Old Block', description: - 'Chimps living at the North Carolina Zoo, a zoo located in the center of North Carolina that serves as the world\'s largest natural habitat zoo, as well as one of two state-supported zoos, are cared for', + "Chimps living at the North Carolina Zoo, a zoo located in the center of North Carolina that serves as the world's largest natural habitat zoo, as well as one of two state-supported zoos, are cared for", categories: ['Reality'], season: 1, - episode: 1, + episode: 1 }) }) From 8602f8e43035532b6707e38182b012f2208cf4a2 Mon Sep 17 00:00:00 2001 From: freearhey <7253922+freearhey@users.noreply.github.com> Date: Sun, 19 Apr 2026 05:02:14 +0300 Subject: [PATCH 2/3] Update tvguide.com.config.js --- sites/tvguide.com/tvguide.com.config.js | 72 ++++++++----------------- 1 file changed, 23 insertions(+), 49 deletions(-) diff --git a/sites/tvguide.com/tvguide.com.config.js b/sites/tvguide.com/tvguide.com.config.js index 6a92a5145..28fb49eed 100644 --- a/sites/tvguide.com/tvguide.com.config.js +++ b/sites/tvguide.com/tvguide.com.config.js @@ -11,28 +11,11 @@ const providerId = '9100001138' const maxDuration = 240 const segments = 1440 / maxDuration const headers = { - 'referer': 'https://www.tvguide.com/', - 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36', + referer: 'https://www.tvguide.com/', + 'User-Agent': + 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36' } -const east_channels = [ - '5StarMax', 'ABC Network Feed', 'ActionMax', 'A&E', 'AMC', 'Animal Planet', 'BBC America', - 'BET', 'BET Her', 'Bravo', 'Cartoon Network', 'CBS National', 'Cinemax', 'CMT', 'Comedy Central', - 'Discovery', 'Disney', 'Disney Junior', 'Disney XD', 'E!', 'Flix', 'Food Network', 'FOX', 'Freeform', - 'Fuse HD', 'FX', 'FXX', 'FYI', 'Game Show Network', 'Hallmark', 'Hallmark Mystery', 'HBO 2', - 'HBO Comedy', 'HBO', 'HBO Family', 'HBO Signature', 'HBO Zone', 'HGTV', 'History', 'IFC', - 'Investigation Discovery', 'ION', 'Lifetime', 'LMN', 'LOGO', 'MAGNOLIA Network', 'MGM+ Hits HD', - 'MoreMax', 'MovieMax', 'MTV2', 'MTV', 'National Geographic', 'National Geographic Wild', 'NBC National', - 'Nickelodeon', 'Nick Jr.', 'Nicktoons', 'OuterMax', 'OWN', 'Oxygen', 'Paramount Network', 'PBS HD', - 'Pop Network', 'SHOWTIME 2', 'Paramount+ with Showtime', 'SHOWTIME EXTREME', 'SHOWTIME FAMILY ZONE', - 'SHOWTIME NEXT', 'SHOWTIME SHOWCASE', 'SHOWTIME WOMEN', 'SHOxBET', 'Smithsonian', 'STARZ Cinema', - 'STARZ Comedy', 'STARZ', 'STARZ Edge', 'STARZ ENCORE Action', 'STARZ ENCORE Black', - 'STARZ ENCORE Classic', 'STARZ ENCORE', 'STARZ ENCORE Family', 'STARZ ENCORE Suspense', - 'STARZ ENCORE Westerns', 'STARZ InBlack', 'STARZ Kids & Family', 'Sundance TV', 'Syfy', 'tbs', - 'Turner Classic Movies', 'TeenNick', 'Telemundo', 'The Movie', 'The Movie Xtra', 'ThrillerMax', 'TLC', - 'TNT', 'Travel', 'truTV', 'TV Land', 'Universal Kids', 'USA', 'VH1', 'WE tv', 'Univision' -] - module.exports = { site: 'tvguide.com', days: 2, @@ -48,21 +31,16 @@ module.exports = { }, async url({ date, segment = 1 }) { const params = [] - if (module.exports.apiKey === undefined) { - module.exports.apiKey = await module.exports.fetchApiKey() - debug('Got api key', module.exports.apiKey) - } if (date) { if (segment > 1) { date = date.add((segment - 1) * maxDuration, 'm') } params.push(`start=${date.unix()}`, `duration=${maxDuration}`) } - params.push(`apiKey=${module.exports.apiKey}`) - return date ? - `https://backend.tvguide.com/tvschedules/tvguide/${providerId}/web?${params.join('&')}` : - `https://backend.tvguide.com/tvschedules/tvguide/serviceprovider/${providerId}/sources/web?${params.join('&')}` + return date + ? `https://backend.tvguide.com/tvschedules/tvguide/${providerId}/web?${params.join('&')}` + : `https://backend.tvguide.com/tvschedules/tvguide/serviceprovider/${providerId}/sources/web?${params.join('&')}` }, async parser({ content, date, channel, fetchSegments = true }) { const programs = [] @@ -75,9 +53,11 @@ module.exports = { data.data.items .filter(i => i.channel.sourceId.toString() === channel.site_id) .forEach(i => { - result.push(...i.programSchedules.map(p => { - return { i: p, url: p.programDetails } - })) + result.push( + ...i.programSchedules.map(p => { + return { i: p, url: p.programDetails } + }) + ) }) } @@ -109,7 +89,7 @@ module.exports = { rating: item.rating ? { system: 'MPA', value: item.rating } : null, categories: Array.isArray(item.genres) ? item.genres.map(g => g.name) : null, start: dayjs.unix(item.startTime || queue.i.startTime), - stop: dayjs.unix(item.endTime || queue.i.endTime), + stop: dayjs.unix(item.endTime || queue.i.endTime) }) } catch (err) { debug(`Failed to fetch program details ${queue.url}: ${err.message}`) @@ -121,32 +101,26 @@ module.exports = { const channels = [] try { const data = await axios - .get(await this.url({}), { headers }) + .get(await this.url({}), { + headers, + proxy: { + protocol: 'http', + host: '127.0.0.1', + port: 1086 + } + }) .then(r => r.data) data.data.items.forEach(item => { - const finalName = item.fullName.replace(/Channel|Schedule/g, '').trim() - const isEast = east_channels.some(name => name.toLowerCase().includes(finalName.toLowerCase())) + const name = item.fullName.replace(/Channel|Schedule/g, '').trim() channels.push({ lang: 'en', site_id: item.sourceId, - xmltv_id: finalName.replaceAll(/[ '&]/g, '') + '.us' + (isEast ? '@East' : ''), - name: finalName + name }) }) } catch (err) { console.error('Failed to fetch channels:', err.message) } return channels - }, - async fetchApiKey() { - try { - const data = await axios - .get('https://www.tvguide.com/listings/') - .then(r => r.data) - return data ? data.match(/apiKey=([a-zA-Z0-9]+)&/)[1] : null - } catch (err) { - console.error('Failed to fetch API key:', err.message) - return null - } } -} \ No newline at end of file +} From 6f5dc6a673f15aba4c2a00a34b82e68dd3947ade Mon Sep 17 00:00:00 2001 From: freearhey <7253922+freearhey@users.noreply.github.com> Date: Sun, 19 Apr 2026 05:04:13 +0300 Subject: [PATCH 3/3] Update tvguide.com.config.js --- sites/tvguide.com/tvguide.com.config.js | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/sites/tvguide.com/tvguide.com.config.js b/sites/tvguide.com/tvguide.com.config.js index 28fb49eed..9f47d0b35 100644 --- a/sites/tvguide.com/tvguide.com.config.js +++ b/sites/tvguide.com/tvguide.com.config.js @@ -100,16 +100,7 @@ module.exports = { async channels() { const channels = [] try { - const data = await axios - .get(await this.url({}), { - headers, - proxy: { - protocol: 'http', - host: '127.0.0.1', - port: 1086 - } - }) - .then(r => r.data) + const data = await axios.get(await this.url({}), { headers }).then(r => r.data) data.data.items.forEach(item => { const name = item.fullName.replace(/Channel|Schedule/g, '').trim() channels.push({