AAAAAAAAAAA, im going to aaaa
This commit is contained in:
parent
0da18c1feb
commit
b0a9d75a14
|
@ -0,0 +1,4 @@
|
||||||
|
{
|
||||||
|
"whitelist": [],
|
||||||
|
"player_id": "0004de42"
|
||||||
|
}
|
6
index.ts
6
index.ts
|
@ -165,11 +165,11 @@ app.ws('/download/:id', async (ws, req) => {
|
||||||
const { streamResults } = await createSabrStream(req.params.id, streamOptions);
|
const { streamResults } = await createSabrStream(req.params.id, streamOptions);
|
||||||
const { videoStream, audioStream, selectedFormats } = streamResults;
|
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)
|
const videoSizeTotal = (selectedFormats.audioFormat.contentLength || 0)
|
||||||
+ (selectedFormats.videoFormat.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('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.');
|
ws.send('This video is too large, and unfortunately, Preservetube does not have unlimited storage.');
|
||||||
return ws.close()
|
return ws.close()
|
||||||
|
@ -325,5 +325,5 @@ setInterval(switchIps, 30 * 60000) // 30 minutes
|
||||||
|
|
||||||
app.listen(8008, () => {
|
app.listen(8008, () => {
|
||||||
console.log('the metadata server is up.')
|
console.log('the metadata server is up.')
|
||||||
switchIps()
|
// switchIps()
|
||||||
})
|
})
|
|
@ -123,7 +123,8 @@ export async function createSabrStream(
|
||||||
innertube: Innertube;
|
innertube: Innertube;
|
||||||
streamResults: StreamResults;
|
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 || '');
|
const webPoTokenResult = await generateWebPoToken(innertube.session.context.client.visitorData || '');
|
||||||
console.log(`debugging -> ${JSON.stringify(webPoTokenResult)}, ${videoId}`)
|
console.log(`debugging -> ${JSON.stringify(webPoTokenResult)}, ${videoId}`)
|
||||||
|
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
["kgcYykfZOs8"]
|
|
Loading…
Reference in New Issue