api/create-filename: build & sanitize filenames in one place

This commit is contained in:
wukko
2024-11-24 18:12:21 +06:00
parent 407c27ed86
commit 6770738116
9 changed files with 25 additions and 34 deletions

View File

@@ -4,7 +4,6 @@ import { fetch } from "undici";
import { Innertube, Session } from "youtubei.js";
import { env } from "../../config.js";
import { cleanString } from "../../misc/utils.js";
import { getCookie, updateCookieValues } from "../cookie/manager.js";
const PLAYER_REFRESH_PERIOD = 1000 * 60 * 15; // ms
@@ -403,8 +402,8 @@ export default async function(o) {
}
const fileMetadata = {
title: cleanString(basicInfo.title.trim()),
artist: cleanString(basicInfo.author.replace("- Topic", "").trim())
title: basicInfo.title.trim(),
artist: basicInfo.author.replace("- Topic", "").trim()
}
if (basicInfo?.short_description?.startsWith("Provided to YouTube by")) {