Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Framasoft
PeerTube
PeerTube
Commits
f82416cc
Verified
Commit
f82416cc
authored
Oct 08, 2021
by
Chocobozzz
Browse files
More robust youtube-dl thumbnail import
parent
78ff11fc
Changes
1
Hide whitespace changes
Inline
Side-by-side
server/controllers/api/videos/import.ts
View file @
f82416cc
...
...
@@ -158,7 +158,11 @@ async function addYoutubeDLImport (req: express.Request, res: express.Response)
// Process video thumbnail from url if processing from request.files failed
if
(
!
thumbnailModel
&&
youtubeDLInfo
.
thumbnailUrl
)
{
thumbnailModel
=
await
processThumbnailFromUrl
(
youtubeDLInfo
.
thumbnailUrl
,
video
)
try
{
thumbnailModel
=
await
processThumbnailFromUrl
(
youtubeDLInfo
.
thumbnailUrl
,
video
)
}
catch
(
err
)
{
logger
.
warn
(
'
Cannot process thumbnail %s from youtubedl.
'
,
youtubeDLInfo
.
thumbnailUrl
,
{
err
})
}
}
// Process video preview from request.files
...
...
@@ -166,7 +170,11 @@ async function addYoutubeDLImport (req: express.Request, res: express.Response)
// Process video preview from url if processing from request.files failed
if
(
!
previewModel
&&
youtubeDLInfo
.
thumbnailUrl
)
{
previewModel
=
await
processPreviewFromUrl
(
youtubeDLInfo
.
thumbnailUrl
,
video
)
try
{
previewModel
=
await
processPreviewFromUrl
(
youtubeDLInfo
.
thumbnailUrl
,
video
)
}
catch
(
err
)
{
logger
.
warn
(
'
Cannot process preview %s from youtubedl.
'
,
youtubeDLInfo
.
thumbnailUrl
,
{
err
})
}
}
const
videoImport
=
await
insertIntoDB
({
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment