people abusing it

This commit is contained in:
localhost 2024-03-30 16:51:13 +01:00
parent 7385448d45
commit 23fdba356e
2 changed files with 3 additions and 6 deletions

View File

@ -127,7 +127,7 @@ exports.playlist = async (ws, req) => {
async function startDownloading() { async function startDownloading() {
const playlist = await metadata.getPlaylistVideos(playlistId) const playlist = await metadata.getPlaylistVideos(playlistId)
for (video of playlist.relatedStreams) { for (video of playlist.relatedStreams.slice(0, 5)) {
if (ws.readyState !== ws.OPEN) { if (ws.readyState !== ws.OPEN) {
return logger.info({ message: `Stopped downloading ${playlistId}, websocket is closed` }) return logger.info({ message: `Stopped downloading ${playlistId}, websocket is closed` })
} }
@ -233,7 +233,7 @@ exports.channel = async (ws, req) => {
async function startDownloading() { async function startDownloading() {
const videos = await metadata.getChannelVideos(channelId) const videos = await metadata.getChannelVideos(channelId)
for (video of videos) { for (video of videos.slice(0, 5)) {
if (ws.readyState !== ws.OPEN) { if (ws.readyState !== ws.OPEN) {
return logger.info({ message: `Stopped downloading ${channelId}, websocket is closed` }) return logger.info({ message: `Stopped downloading ${channelId}, websocket is closed` })
} }

View File

@ -122,10 +122,7 @@ async function getPlaylistVideos(id) {
'User-Agent': 'Mozilla/5.0 (compatible; PreserveTube/0.0; +https://preservetube.com)' 'User-Agent': 'Mozilla/5.0 (compatible; PreserveTube/0.0; +https://preservetube.com)'
} }
})).json() })).json()
return { return json
...json,
relatedStreams: json.relatedStreams.slice(0, 5)
}
} }
async function getVideoDownload(url, quality) { async function getVideoDownload(url, quality) {