I Like
I Like

Reputation: 1847

YouTube network request Strange Behaviour

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!

https://www.youtube.com/api/timedtext?xoaf=1&expire=1541822131&signature=585C6AB59561084DC1B7F963679FF2D916257EFA.5EBAF0C3037FD561A0636CA47CF95396773DB78B&hl=en&asr_langs=ja%2Cpt%2Cde%2Cko%2Cru%2Cen%2Cnl%2Ces%2Cfr%2Cit&sparams=asr_langs%2Ccaps%2Cv%2Cxoaf%2Cxorp%2Cexpire&v=FSyAehMdpyI&caps=asr&key=yttt1&xorp=True&lang=en&fmt=srv3

Is there a permanent solution for storing these automatic captions?

Upvotes: -1

Views: 35

Answers (1)

I Like
I Like

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

Related Questions