go back
This commit is contained in:
parent
4c9fa6f00c
commit
7128d15ad2
10
index.js
10
index.js
|
@ -1,6 +1,4 @@
|
|||
require('dotenv').config()
|
||||
const express = require('express')
|
||||
const { randomDispatcher } = require('freebind');
|
||||
const { Innertube, Utils } = require('@preservetube/youtube.js');
|
||||
const hr = require('@tsmx/human-readable')
|
||||
|
||||
|
@ -9,7 +7,6 @@ const ffmpegStatic = require('ffmpeg-static')
|
|||
const fs = require('node:fs')
|
||||
|
||||
const app = express()
|
||||
const dispatcher = randomDispatcher(process.env.RANGE)
|
||||
require('express-ws')(app)
|
||||
|
||||
ffmpeg.setFfmpegPath(ffmpegStatic)
|
||||
|
@ -124,12 +121,7 @@ app.get('/videos/:id', async (req, res) => {
|
|||
})
|
||||
|
||||
app.ws('/download/:id/:quality', async (ws, req) => {
|
||||
const yt = await Innertube.create({
|
||||
fetch: (input, init) => fetch(input, {
|
||||
...init,
|
||||
dispatcher: dispatcher
|
||||
})
|
||||
});
|
||||
const yt = await Innertube.create();
|
||||
const info = await yt.getInfo(req.params.id, 'ANDROID');
|
||||
if (info.playability_status.status !== 'OK') {
|
||||
ws.send(`This video is not available for download (${info.playability_status.status} ${info.playability_status.reason}).`);
|
||||
|
|
|
@ -6,11 +6,9 @@
|
|||
"dependencies": {
|
||||
"@preservetube/youtube.js": "^13.1.0",
|
||||
"@tsmx/human-readable": "^2.0.3",
|
||||
"dotenv": "^16.4.7",
|
||||
"express": "^4.21.1",
|
||||
"express-ws": "^5.0.2",
|
||||
"ffmpeg-static": "^5.2.0",
|
||||
"fluent-ffmpeg": "^2.1.3",
|
||||
"freebind": "^0.2.2"
|
||||
"fluent-ffmpeg": "^2.1.3"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue