aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-10-08 15:06:45 +0200
committerChocobozzz <me@florianbigard.com>2021-10-08 15:06:45 +0200
commitf82416cc58f6c1d0496935e815f3fcb2fdda88ea (patch)
tree0023e733c0969dc8aa30c72a76736d35516a1673
parent78ff11fc25a0db3d7adfa5b06446b1f9f5ef4a77 (diff)
downloadPeerTube-f82416cc58f6c1d0496935e815f3fcb2fdda88ea.tar.gz
PeerTube-f82416cc58f6c1d0496935e815f3fcb2fdda88ea.tar.zst
PeerTube-f82416cc58f6c1d0496935e815f3fcb2fdda88ea.zip
More robust youtube-dl thumbnail import
-rw-r--r--server/controllers/api/videos/import.ts12
1 files changed, 10 insertions, 2 deletions
diff --git a/server/controllers/api/videos/import.ts b/server/controllers/api/videos/import.ts
index 5f90e4308..4265f3217 100644
--- a/server/controllers/api/videos/import.ts
+++ b/server/controllers/api/videos/import.ts
@@ -158,7 +158,11 @@ async function addYoutubeDLImport (req: express.Request, res: express.Response)
158 158
159 // Process video thumbnail from url if processing from request.files failed 159 // Process video thumbnail from url if processing from request.files failed
160 if (!thumbnailModel && youtubeDLInfo.thumbnailUrl) { 160 if (!thumbnailModel && youtubeDLInfo.thumbnailUrl) {
161 thumbnailModel = await processThumbnailFromUrl(youtubeDLInfo.thumbnailUrl, video) 161 try {
162 thumbnailModel = await processThumbnailFromUrl(youtubeDLInfo.thumbnailUrl, video)
163 } catch (err) {
164 logger.warn('Cannot process thumbnail %s from youtubedl.', youtubeDLInfo.thumbnailUrl, { err })
165 }
162 } 166 }
163 167
164 // Process video preview from request.files 168 // Process video preview from request.files
@@ -166,7 +170,11 @@ async function addYoutubeDLImport (req: express.Request, res: express.Response)
166 170
167 // Process video preview from url if processing from request.files failed 171 // Process video preview from url if processing from request.files failed
168 if (!previewModel && youtubeDLInfo.thumbnailUrl) { 172 if (!previewModel && youtubeDLInfo.thumbnailUrl) {
169 previewModel = await processPreviewFromUrl(youtubeDLInfo.thumbnailUrl, video) 173 try {
174 previewModel = await processPreviewFromUrl(youtubeDLInfo.thumbnailUrl, video)
175 } catch (err) {
176 logger.warn('Cannot process preview %s from youtubedl.', youtubeDLInfo.thumbnailUrl, { err })
177 }
170 } 178 }
171 179
172 const videoImport = await insertIntoDB({ 180 const videoImport = await insertIntoDB({