Skip to content

Commit

Permalink
Fixed issue with ESPN vs fox chunklist urls
Browse files Browse the repository at this point in the history
  • Loading branch information
m0ngr31 committed Feb 14, 2023
1 parent 3a219ea commit 0269e85
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
2 changes: 1 addition & 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: **2.0.6**
Current version: **2.0.7**

# About
This takes ESPN/ESPN+, FOX Sports, and NBC Sports 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), [Channels](https://getchannels.com), or [xTeVe](https://github.com/xteve-project/xTeVe).
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": "2.0.6",
"version": "2.0.7",
"description": "",
"main": "index.js",
"scripts": {
Expand Down
15 changes: 9 additions & 6 deletions services/playlist-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,15 @@ const createBaseUrl = (url: string): string => {
const cleaned = url.replace(/\.m3u8.*$/, '');
return cleaned.substring(0, cleaned.lastIndexOf('/') + 1);
};
const createBaseUrlChunklist = (url: string): string => {
const createBaseUrlChunklist = (url: string, network: string): string => {
const cleaned = url.replace(/\.m3u8.*$/, '');
const filteredUrl = cleaned
.split('/')
.filter(seg => !seg.match(/=/))
.join('/');
let filteredUrl: string[] | string = cleaned.split('/');

if (network === 'foxsports') {
filteredUrl = filteredUrl.filter(seg => !seg.match(/=/));
}

filteredUrl = filteredUrl.join('/');
return filteredUrl.substring(0, filteredUrl.lastIndexOf('/') + 1);
};
const usesHostRoot = (url: string): boolean => url.startsWith('/');
Expand Down Expand Up @@ -245,7 +248,7 @@ export class PlaylistHandler {
});

const realChunklistUrl = request.res.responseUrl;
const baseManifestUrl = cleanUrl(createBaseUrlChunklist(realChunklistUrl));
const baseManifestUrl = cleanUrl(createBaseUrlChunklist(realChunklistUrl, this.network));
const urlParams = new URL(realChunklistUrl).search;

if (!this.segmentDuration) {
Expand Down

0 comments on commit 0269e85

Please sign in to comment.