Skip to content
This repository was archived by the owner on Aug 16, 2025. It is now read-only.

Could not download captions as seen in captions.js example #275

@Haz1897

Description

@Haz1897

i tried to fetch subtitles using the link provided from ytdl.getInfo(URL), which is then sent to the downloadSubtitles function as follows:

function downloadSubtitles(subtitles,title,folderLocation){

        // If there is no subtitles, return
        if(!subtitles)
            return;

        // Format to be downloaded is vtt.
        const format = 'vtt';
        const output = join(folderLocation,`${title}-${subtitles.languageCode}-youtube.${format}`);
        let outputStream = fs.createWriteStream(output);
        https.get(`${subtitles.baseUrl}&fmt=${format !== 'xml' ? format : ''}`, res => {
            res.pipe(outputStream);
        })

    

    }

The https request returns an empty string. I tried to paste the baseUrl into the browser and got an empty screen as well. I am unsure what could be going wrong when fetching the subtitles. Here is an example baseUrl that i used:

https://www.youtube.com/api/timedtext?v=35nV_M3asRs&ei=NzZgaK7AA5ncp-oPvMrM8QM&caps=asr&opi=112496729&exp=xpe&xoaf=5&hl=en&ip=0.0.0.0&ipbits=0&expire=1751160999&sparams=ip,ipbits,expire,v,ei,caps,opi,exp,xoaf&signature=1A60B06E96BC3F086F7F71A1A5CA6467C42A7B43.D07B860D05A4AE4E55DBB18B3B3BAF4A5CF3506E&key=yt8&lang=en

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions