Reputation: 1847
I'm scraping YouTube videos for automatic captions and storing them locally. I use window.performance.getEntries()
to find the link to the subtitles after enabling subtitles, but when I tried to open some of the links the day after I retrieved them I got a 404
error.
Here is a now-defunct link to a YouTube video's captions that I retrieved yesterday: https://www.youtube.com/api/timedtext?sparams=asr_langs%2Ccaps%2Cv%2Cxoaf%2Cxorp%2Cexpire&hl=en&signature=B50CC4269D15CD954D6946B6342194EDF9F6D01F.AF819BEDE91E0F31C8F02A04508E49FC02B4F504&xorp=True&v=FSyAehMdpyI&asr_langs=ja%2Cko%2Cen%2Cde%2Cpt%2Cru%2Cnl%2Cfr%2Cit%2Ces&xoaf=1&key=yttt1&caps=asr&expire=1541769833&lang=en&fmt=srv3
I scraped the subtitles link from the same video and it's now changed!
Is there a permanent solution for storing these automatic captions?
Upvotes: -1
Views: 35
Reputation: 1847
All I had to do was remove the expire parameter in the URL and it worked again. e.g. deleted &expire=1541769833
in below link.
https://www.youtube.com/api/timedtext?sparams=asr_langs%2Ccaps%2Cv%2Cxoaf%2Cxorp%2Cexpire&hl=en&signature=B50CC4269D15CD954D6946B6342194EDF9F6D01F.AF819BEDE91E0F31C8F02A04508E49FC02B4F504&xorp=True&v=FSyAehMdpyI&asr_langs=ja%2Cko%2Cen%2Cde%2Cpt%2Cru%2Cnl%2Cfr%2Cit%2Ces&xoaf=1&key=yttt1&caps=asr&lang=en&fmt=srv3
Upvotes: 0