aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/youtube-dl.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/helpers/youtube-dl.ts')
-rw-r--r--server/helpers/youtube-dl.ts5
1 files changed, 3 insertions, 2 deletions
diff --git a/server/helpers/youtube-dl.ts b/server/helpers/youtube-dl.ts
index 302b2e206..9e8ef90d8 100644
--- a/server/helpers/youtube-dl.ts
+++ b/server/helpers/youtube-dl.ts
@@ -7,6 +7,7 @@ import { ensureDir, remove, writeFile } from 'fs-extra'
7import * as request from 'request' 7import * as request from 'request'
8import { createWriteStream } from 'fs' 8import { createWriteStream } from 'fs'
9import { CONFIG } from '@server/initializers/config' 9import { CONFIG } from '@server/initializers/config'
10import { HttpStatusCode } from '../../shared/core-utils/miscs/http-error-codes'
10 11
11export type YoutubeDLInfo = { 12export type YoutubeDLInfo = {
12 name?: string 13 name?: string
@@ -154,7 +155,7 @@ async function updateYoutubeDLBinary () {
154 return res() 155 return res()
155 } 156 }
156 157
157 if (result.statusCode !== 302) { 158 if (result.statusCode !== HttpStatusCode.FOUND_302) {
158 logger.error('youtube-dl update error: did not get redirect for the latest version link. Status %d', result.statusCode) 159 logger.error('youtube-dl update error: did not get redirect for the latest version link. Status %d', result.statusCode)
159 return res() 160 return res()
160 } 161 }
@@ -164,7 +165,7 @@ async function updateYoutubeDLBinary () {
164 const newVersion = /yt-dl\.org\/downloads\/(\d{4}\.\d\d\.\d\d(\.\d)?)\/youtube-dl/.exec(url)[1] 165 const newVersion = /yt-dl\.org\/downloads\/(\d{4}\.\d\d\.\d\d(\.\d)?)\/youtube-dl/.exec(url)[1]
165 166
166 downloadFile.on('response', result => { 167 downloadFile.on('response', result => {
167 if (result.statusCode !== 200) { 168 if (result.statusCode !== HttpStatusCode.OK_200) {
168 logger.error('Cannot update youtube-dl: new version response is not 200, it\'s %d.', result.statusCode) 169 logger.error('Cannot update youtube-dl: new version response is not 200, it\'s %d.', result.statusCode)
169 return res() 170 return res()
170 } 171 }