give error to client
This commit is contained in:
		
							parent
							
								
									a181ecfe79
								
							
						
					
					
						commit
						405c28afd6
					
				| 
						 | 
					@ -57,7 +57,7 @@ exports.save = async (ws, req) => {
 | 
				
			||||||
        if (msg == 'alive') return 
 | 
					        if (msg == 'alive') return 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (await redis.get(id) != 'downloading') {
 | 
					        if (await redis.get(id) != 'downloading') {
 | 
				
			||||||
            await redis.set(id, 'downloading')
 | 
					            await redis.set(id, 'downloading', 'EX', 300)
 | 
				
			||||||
            const confirm = await captcha.checkCaptcha(msg)
 | 
					            const confirm = await captcha.checkCaptcha(msg)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (confirm) startDownloading()
 | 
					            if (confirm) startDownloading()
 | 
				
			||||||
| 
						 | 
					@ -168,7 +168,7 @@ exports.playlist = async (ws, req) => {
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            ws.send(`INFO - Downloading ${video.title}<br><br>`)
 | 
					            ws.send(`INFO - Downloading ${video.title}<br><br>`)
 | 
				
			||||||
            await redis.set(id, 'downloading')
 | 
					            await redis.set(id, 'downloading', 'EX', 300)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            const download = await ytdlp.downloadVideo('https://www.youtube.com' + video.url, ws, id)
 | 
					            const download = await ytdlp.downloadVideo('https://www.youtube.com' + video.url, ws, id)
 | 
				
			||||||
            if (download.fail) {
 | 
					            if (download.fail) {
 | 
				
			||||||
| 
						 | 
					@ -264,7 +264,7 @@ exports.channel = async (ws, req) => {
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            
 | 
					            
 | 
				
			||||||
            ws.send(`INFO - Downloading ${video.title.text}<br><br>`)
 | 
					            ws.send(`INFO - Downloading ${video.title.text}<br><br>`)
 | 
				
			||||||
            await redis.set(video.id, 'downloading')
 | 
					            await redis.set(video.id, 'downloading', 'EX', 300)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            const download = await ytdlp.downloadVideo(`https://www.youtube.com/watch?v=${video.id}`, ws, video.id)
 | 
					            const download = await ytdlp.downloadVideo(`https://www.youtube.com/watch?v=${video.id}`, ws, video.id)
 | 
				
			||||||
            if (download.fail) {
 | 
					            if (download.fail) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -18,7 +18,7 @@ async function downloadVideo(url, ws, id) {
 | 
				
			||||||
        const downloadJson = await metadata.getVideoDownload(url, quality)
 | 
					        const downloadJson = await metadata.getVideoDownload(url, quality)
 | 
				
			||||||
        if (downloadJson.status == 'error') {
 | 
					        if (downloadJson.status == 'error') {
 | 
				
			||||||
            return resolve({
 | 
					            return resolve({
 | 
				
			||||||
                message: 'Failed to request Youtube. Please retry...',
 | 
					                message: `Failed to request Youtube with error ${downloadJson.text}. Please retry...`,
 | 
				
			||||||
                fail: true
 | 
					                fail: true
 | 
				
			||||||
            })
 | 
					            })
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue