MCPcopy Create free account
hub / github.com/TeleBoxOrg/TeleBox_Plugins / normalizeTextForFile

Function normalizeTextForFile

yt-dlp/yt-dlp.ts:234–239  ·  view source on GitHub ↗
(text: string)

Source from the content-addressed store, hash-verified

232}
233
234function normalizeTextForFile(text: string): string {
235    return (text || "未知").replace(/[\u200B-\u200D\uFEFF]/g, "").replace(/\s+/g, " ").trim()
236        .replace(/[–—‐‑‒⁃−➖﹘﹣]/g, "-").replace(/^[-_\s]+|[-_\s]+$/g, "")
237        .replace(/[\\/\?%\*:|"<>]/g, "_").replace(/[ _]{2,}/g, " ")
238        .slice(0, 120).replace(/[ .]+$/g, "") || "未知";
239}
240
241function buildNormalizedFileName(artist: string, title: string): string {
242    return `${normalizeTextForFile(title)} - ${normalizeTextForFile(artist)}`;

Callers 1

buildNormalizedFileNameFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected