From b0a9d75a14d6e880a19c63fc0443406d48560c22 Mon Sep 17 00:00:00 2001 From: localhost Date: Wed, 24 Sep 2025 20:51:13 +0200 Subject: [PATCH] AAAAAAAAAAA, im going to aaaa --- config.json | 4 ++++ index.ts | 6 +++--- utils/sabr-stream-factory.ts | 3 ++- whitelist.json | 1 - 4 files changed, 9 insertions(+), 5 deletions(-) create mode 100644 config.json delete mode 100644 whitelist.json diff --git a/config.json b/config.json new file mode 100644 index 0000000..c78774b --- /dev/null +++ b/config.json @@ -0,0 +1,4 @@ +{ + "whitelist": [], + "player_id": "0004de42" +} \ No newline at end of file diff --git a/index.ts b/index.ts index 96412f3..76edcc0 100644 --- a/index.ts +++ b/index.ts @@ -165,11 +165,11 @@ app.ws('/download/:id', async (ws, req) => { const { streamResults } = await createSabrStream(req.params.id, streamOptions); const { videoStream, audioStream, selectedFormats } = streamResults; - const whitelistedVideos = JSON.parse(fs.readFileSync('./whitelist.json', 'utf-8')) + const config = await Bun.file('config.json').json() const videoSizeTotal = (selectedFormats.audioFormat.contentLength || 0) + (selectedFormats.videoFormat.contentLength || 0) - if (videoSizeTotal > (1_048_576 * 150) && !whitelistedVideos.includes(req.params.id)) { + if (videoSizeTotal > (1_048_576 * 150) && !config.whitelist.includes(req.params.id)) { ws.send('Is this content considered high risk? If so, please email me at admin@preservetube.com.'); ws.send('This video is too large, and unfortunately, Preservetube does not have unlimited storage.'); return ws.close() @@ -325,5 +325,5 @@ setInterval(switchIps, 30 * 60000) // 30 minutes app.listen(8008, () => { console.log('the metadata server is up.') - switchIps() + // switchIps() }) \ No newline at end of file diff --git a/utils/sabr-stream-factory.ts b/utils/sabr-stream-factory.ts index 8c22e01..9f69c6d 100644 --- a/utils/sabr-stream-factory.ts +++ b/utils/sabr-stream-factory.ts @@ -123,7 +123,8 @@ export async function createSabrStream( innertube: Innertube; streamResults: StreamResults; }> { - const innertube = await Innertube.create({ cache: new UniversalCache(true) }); + const json = await Bun.file('config.json').json() + const innertube = await Innertube.create({ cache: new UniversalCache(true), player_id: json.player_id }); const webPoTokenResult = await generateWebPoToken(innertube.session.context.client.visitorData || ''); console.log(`debugging -> ${JSON.stringify(webPoTokenResult)}, ${videoId}`) diff --git a/whitelist.json b/whitelist.json deleted file mode 100644 index 43312b0..0000000 --- a/whitelist.json +++ /dev/null @@ -1 +0,0 @@ -["kgcYykfZOs8"] \ No newline at end of file