From fc7a42ef63f3e407d191b20cb909612b872cb7e4 Mon Sep 17 00:00:00 2001 From: Your Name Date: Sun, 6 Oct 2024 11:59:12 -0600 Subject: [PATCH] Added support for NFL Sunday Ticket --- README.md | 3 ++- package-lock.json | 4 ++-- package.json | 2 +- services/networks.ts | 4 ++++ services/nfl-handler.ts | 38 +++++++++++++++++++++++++++++++++++++- 5 files changed, 46 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 091769c..e57d9ba 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@

-Current version: **3.2.7** +Current version: **3.2.8** # About This takes ESPN/ESPN+, FOX Sports, Paramount+, MSG+, NFL+, B1G+, NESN, Mountain West, FloSports, or MLB.tv programming and transforms it into a "live TV" experience with virtual linear channels. It will discover what is on, and generate a schedule of channels that will give you M3U and XMLTV files that you can import into something like [Jellyfin](https://jellyfin.org) or [Channels](https://getchannels.com). @@ -82,6 +82,7 @@ Please note that if you only have an NFL account, you can still get events from | NFL_TVE | Set if you would like NFL games from your TV Provider (not needed with NFL+) | False | False | | NFL_PRIME | Set if you would like NFL games from Amazon Prime (not needed with NFL+) | False | False | | NFL_PEACOCK | Set if you would like NFL games from Peacock (not needed with NFL+) | False | False | +| NFL_SUNDAY_TICKET | Set if you would like NFL games from Sunday Ticket | False | False | | NFLNETWORK* | Set if you would like the NFL Network channel (only available with `LINEAR_CHANNELS`). Must have NFL+ or TV Provider. | False | False | | NFLCHANNEL* | Set if you would like the NFL Channel (only available with `LINEAR_CHANNELS`) | False | False | diff --git a/package-lock.json b/package-lock.json index 7fa8394..418dcc5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "eplustv", - "version": "3.2.7", + "version": "3.2.8", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "eplustv", - "version": "3.2.7", + "version": "3.2.8", "license": "MIT", "dependencies": { "axios": "^1.2.2", diff --git a/package.json b/package.json index 63dfaa0..e210d01 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "eplustv", - "version": "3.2.7", + "version": "3.2.8", "description": "", "scripts": { "start": "ts-node index.ts", diff --git a/services/networks.ts b/services/networks.ts index b045652..fe0471d 100644 --- a/services/networks.ts +++ b/services/networks.ts @@ -41,6 +41,7 @@ export const useNfl = { _peacock: process.env.NFL_PEACOCK?.toLowerCase() === 'true' ? true : false, _prime: process.env.NFL_PRIME?.toLowerCase() === 'true' ? true : false, _redZone: false, + _sunday_ticket: process.env.NFL_SUNDAY_TICKET?.toLowerCase() === 'true' ? true : false, _tve: process.env.NFL_TVE?.toLowerCase() === 'true' ? true : false, get channel(): boolean { return this._channel && this.plus; @@ -64,6 +65,9 @@ export const useNfl = { set redZone(value: boolean) { this._redZone = value; }, + get sundayTicket(): boolean { + return this._sunday_ticket && this.plus; + }, get tve(): boolean { return this._tve && this.plus; }, diff --git a/services/nfl-handler.ts b/services/nfl-handler.ts index 84d3e2e..9340c19 100644 --- a/services/nfl-handler.ts +++ b/services/nfl-handler.ts @@ -157,7 +157,7 @@ const TV_DEVICE_INFO = { const DEFAULT_CATEGORIES = ['NFL', 'NFL+', 'Football']; -type TOtherAuth = 'prime' | 'tve' | 'peacock'; +type TOtherAuth = 'prime' | 'tve' | 'peacock' | 'sunday_ticket'; interface INFLJwt { dmaCode: string; @@ -239,6 +239,8 @@ class NflHandler { public amazonPrimeUUID?: string; public peacockUserId?: string; public peacockUUID?: string; + public youTubeUserId?: string; + public youTubeUUID?: string; public initialize = async () => { if (!useNfl.plus) { @@ -268,6 +270,10 @@ class NflHandler { if (useNfl.prime && (!this.amazonPrimeUserId || !this.amazonPrimeUUID)) { await this.startProviderAuthFlow('prime'); } + + if (useNfl.sundayTicket && (!this.youTubeUserId || !this.youTubeUUID)) { + await this.startProviderAuthFlow('sunday_ticket'); + } }; public refreshTokens = async () => { @@ -339,6 +345,14 @@ class NflHandler { events.push(i); } else if (i.callSign === 'NFLNETWORK' && nflNetworkAccess && i.contentType !== 'AUDIO') { events.push(i); + } else if ( + // Sunday Ticket + i.contentType === 'GAME' && + i.language.find(l => l === 'en') && + i.authorizations.sunday_ticket && + this.checkSundayTicket() + ) { + events.push(i); } } }); @@ -463,6 +477,7 @@ class NflHandler { private checkTVEAccess = (): boolean => (this.mvpdIdp && useNfl.tve ? true : false); private checkPeacockAccess = (): boolean => (this.peacockUserId && useNfl.peacock ? true : false); private checkPrimeAccess = (): boolean => (this.amazonPrimeUserId && useNfl.prime ? true : false); + private checkSundayTicket = (): boolean => (this.youTubeUserId && useNfl.sundayTicket ? true : false); private checkTVEEventAccess = (event: INFLEvent): boolean => { let hasChannel = false; @@ -516,6 +531,10 @@ class NflHandler { peacockUUID: this.peacockUUID, peacockUserId: this.peacockUserId, }), + ...(this.youTubeUserId && { + youTubeUUID: this.youTubeUUID, + youTubeUserId: this.youTubeUserId, + }), }, { headers: { @@ -579,6 +598,10 @@ class NflHandler { peacockUUID: this.peacockUUID, peacockUserId: this.peacockUserId, }), + ...(this.youTubeUserId && { + youTubeUUID: this.youTubeUUID, + youTubeUserId: this.youTubeUserId, + }), }, { headers: { @@ -722,6 +745,10 @@ class NflHandler { idp: 'PEACOCK', nflAccount: false, }), + ...(otherAuth === 'sunday_ticket' && { + idp: 'YOUTUBE', + nflAccount: false, + }), }, { headers: { @@ -739,6 +766,8 @@ class NflHandler { ? '(Amazon Prime) ' : otherAuth === 'peacock' ? '(Peacock) ' + : otherAuth === 'sunday_ticket' + ? '(Youtube) ' : ''; console.log(`=== NFL+ Auth ${otherAuthName}===`); @@ -809,6 +838,9 @@ class NflHandler { } else if (otherAuth === 'peacock') { this.peacockUserId = data.userId; this.peacockUUID = data.uuid; + } else if (otherAuth === 'sunday_ticket') { + this.youTubeUserId = data.userId; + this.youTubeUUID = data.uuid; } this.save(); @@ -854,6 +886,8 @@ class NflHandler { amazonPrimeUUID, peacockUserId, peacockUUID, + youTubeUserId, + youTubeUUID, } = fsExtra.readJSONSync(path.join(configPath, 'nfl_tokens.json')); this.device_id = device_id; @@ -873,6 +907,8 @@ class NflHandler { this.amazonPrimeUserId = amazonPrimeUserId; this.peacockUserId = peacockUserId; this.peacockUUID = peacockUUID; + this.youTubeUUID = youTubeUUID; + this.youTubeUserId = youTubeUserId; } }; }