From 42fdc6b61622b7f3bd7e5a9cacc36d03ee944f56 Mon Sep 17 00:00:00 2001 From: Trevor Sharp Date: Wed, 11 Oct 2023 18:03:20 +0000 Subject: [PATCH] Testing --- src/index.ts | 2 ++ src/services/contentService.ts | 2 +- src/services/streamService.ts | 4 +--- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/index.ts b/src/index.ts index df5c9e6..fd54828 100644 --- a/src/index.ts +++ b/src/index.ts @@ -85,6 +85,8 @@ app.get('/video/:videoId', async (req, res) => { try { const videoId = req.params.videoId; + console.log(videoId); + const MAX_QUALITY = 2160; const ADAPTIVE_QUALITY = true; diff --git a/src/services/contentService.ts b/src/services/contentService.ts index 786d234..346e6f7 100644 --- a/src/services/contentService.ts +++ b/src/services/contentService.ts @@ -8,7 +8,7 @@ import { CONTENT_DIRECTORY } from '..'; const getLocalFormats = async (videoId: string): Promise => { const content = await fs.promises.readdir(CONTENT_DIRECTORY); - console.log(content.filter((file) => file.replace(/^([^.]+)\..*$/, '$1') === videoId)); + console.log(content.filter((file) => file.includes(decodeURI(encodeURI(videoId))))); const videoFile = content.find((file) => file.startsWith('cB') && file.includes('.ts')); const playlistFile = content.find((file) => file.startsWith('cB') && file.includes('.m3u8')); diff --git a/src/services/streamService.ts b/src/services/streamService.ts index 2b3143f..c14c889 100644 --- a/src/services/streamService.ts +++ b/src/services/streamService.ts @@ -14,9 +14,7 @@ const buildStream = ( }"\n\n${videoStreams .map( (stream) => - `#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=${stream.bitrate},CODECS="${ - stream.codec - }",RESOLUTION=${stream.resolution}${stream.hasAudio ? '' : ',AUDIO="audio"'}\n${stream.url}` + `#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=${stream.bitrate},CODECS="${stream.codec}",RESOLUTION=${stream.resolution},AUDIO="audio"\n${stream.url}` ) .join('\n\n')}`; };