Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions api/src/processing/services/vk.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,11 @@ export default async function ({ ownerId, videoId, accessKey, quality, subtitleL

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

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

const fileMetadata = { title }

let subtitles;
if (subtitleLang && video.subtitles?.length) {
Expand Down
18 changes: 18 additions & 0 deletions api/src/util/tests/vk.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,24 @@
"status": "tunnel"
}
},
{
"name": "clip without title",
"url": "https://vk.com/clip-227182972_456239182",
"params": {},
"expected": {
"code": 200,
"status": "tunnel"
}
},
{
"name": "clip without title or description",
"url": "https://vk.com/clip-219815090_456243369",
"params": {},
"expected": {
"code": 200,
"status": "tunnel"
}
},
{
"name": "video, defaults",
"url": "https://vk.com/video-57274055_456239399",
Expand Down