Skip to content

Commit

Permalink
Added support for NFL Sunday Ticket
Browse files Browse the repository at this point in the history
  • Loading branch information
Your Name committed Oct 6, 2024
1 parent 5f53efb commit fc7a42e
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 5 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<img src="https://i.imgur.com/FIGZdR3.png">
</p>

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).
Expand Down Expand Up @@ -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 |

Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "eplustv",
"version": "3.2.7",
"version": "3.2.8",
"description": "",
"scripts": {
"start": "ts-node index.ts",
Expand Down
4 changes: 4 additions & 0 deletions services/networks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
},
Expand Down
38 changes: 37 additions & 1 deletion services/nfl-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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 () => {
Expand Down Expand Up @@ -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);
}
}
});
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -516,6 +531,10 @@ class NflHandler {
peacockUUID: this.peacockUUID,
peacockUserId: this.peacockUserId,
}),
...(this.youTubeUserId && {
youTubeUUID: this.youTubeUUID,
youTubeUserId: this.youTubeUserId,
}),
},
{
headers: {
Expand Down Expand Up @@ -579,6 +598,10 @@ class NflHandler {
peacockUUID: this.peacockUUID,
peacockUserId: this.peacockUserId,
}),
...(this.youTubeUserId && {
youTubeUUID: this.youTubeUUID,
youTubeUserId: this.youTubeUserId,
}),
},
{
headers: {
Expand Down Expand Up @@ -722,6 +745,10 @@ class NflHandler {
idp: 'PEACOCK',
nflAccount: false,
}),
...(otherAuth === 'sunday_ticket' && {
idp: 'YOUTUBE',
nflAccount: false,
}),
},
{
headers: {
Expand All @@ -739,6 +766,8 @@ class NflHandler {
? '(Amazon Prime) '
: otherAuth === 'peacock'
? '(Peacock) '
: otherAuth === 'sunday_ticket'
? '(Youtube) '
: '';

console.log(`=== NFL+ Auth ${otherAuthName}===`);
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -854,6 +886,8 @@ class NflHandler {
amazonPrimeUUID,
peacockUserId,
peacockUUID,
youTubeUserId,
youTubeUUID,
} = fsExtra.readJSONSync(path.join(configPath, 'nfl_tokens.json'));

this.device_id = device_id;
Expand All @@ -873,6 +907,8 @@ class NflHandler {
this.amazonPrimeUserId = amazonPrimeUserId;
this.peacockUserId = peacockUserId;
this.peacockUUID = peacockUUID;
this.youTubeUUID = youTubeUUID;
this.youTubeUserId = youTubeUserId;
}
};
}
Expand Down

0 comments on commit fc7a42e

Please sign in to comment.