INNER CODE UNIT · TypeScript

getDownloadLink

xcodian/youtube-dl-web · frontend/src/logic/download.ts:42

export function getDownloadLink(
    id: string,
    videoFrom: Format | "none",
    audioFrom: Format | "none",
): string {
    let f = `/api/dl/${id}?f=`;

    if (audioFrom == "none") {
        // only download video
        f += (videoFrom as Format).id 
    } else {
        if (videoFrom == "none") {
            // no video, only audio, no need to add +
            f += audioFrom.id
        } else {
            // download with + since there is a specific video and specific audio
            f += videoFrom.id + "%2B" + audioFrom.id
        }

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…