Skip to content

Commit 639f1ae

Browse files
author
lambovl
committed
api/vk: handle clips without titles
cherry-picked from upstream PR imputnet#1580 by @Rexarrior
1 parent d70129d commit 639f1ae

2 files changed

Lines changed: 23 additions & 3 deletions

File tree

api/src/processing/services/vk.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,11 @@ export default async function ({ ownerId, videoId, accessKey, quality, subtitleL
125125

126126
if (!url) return { error: "fetch.fail" };
127127

128-
const fileMetadata = {
129-
title: video.title.trim(),
130-
}
128+
const title = video.title?.trim()
129+
|| video.description?.trim().split(/\r?\n/, 1)[0]
130+
|| `vk_${ownerId}_${videoId}`;
131+
132+
const fileMetadata = { title }
131133

132134
let subtitles;
133135
if (subtitleLang && video.subtitles?.length) {

api/src/util/tests/vk.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,24 @@
3030
"status": "tunnel"
3131
}
3232
},
33+
{
34+
"name": "clip without title",
35+
"url": "https://vk.com/clip-227182972_456239182",
36+
"params": {},
37+
"expected": {
38+
"code": 200,
39+
"status": "tunnel"
40+
}
41+
},
42+
{
43+
"name": "clip without title or description",
44+
"url": "https://vk.com/clip-219815090_456243369",
45+
"params": {},
46+
"expected": {
47+
"code": 200,
48+
"status": "tunnel"
49+
}
50+
},
3351
{
3452
"name": "video, defaults",
3553
"url": "https://vk.com/video-57274055_456239399",

0 commit comments

Comments
 (0)