ivanxuu/getyoutubecc

Does not work with all videos

Opened this issue · 10 comments

For example:

http://www.youtube.com/watch?v=pNiFoYt69-w

The /timedtext url doesn't return anything - any idea why? This tool can do it:

http://mo.dbxdb.com/

Turns out you need to specify the name as well:

http://video.google.com/timedtext?lang=fr&v=PILzP-bIeLo&name=french

yep! you are right
It happens that when the track has a name (for instance in multitrack videos), the track name must be in the name parameter (and thats mandatory or you will get an empty response)
I will take a look ASAP

Now, it should work with:

./getyoutubecc.py -v PILzP-bIeLo -l fr -t french

BTW if you want a translation of that video (google automated translation):

./getyoutubecc.py -v PILzP-bIeLo -l fr -t french -T en

I'm seeing problems with some videos, eg. https://www.youtube.com/watch?v=C0kaHon3I3o

$ ./getyoutubecc.py -v C0kaHon3I3o -l en -t english
downloading C0kaHon3I3o captions
video id: C0kaHon3I3o
video language: en
video track: english
translate video to:

It doesn't create an output file. Same problem without the -l or -t arguments. Any fix for this?

Looking at the network inspector when loading https://www.youtube.com/watch?v=gBu21qdGDl4 I see that the page loads the subtitles from https://www.youtube.com/api/timedtext?caps=asr&hl=en-GB&signature=26433C4A5DD34B3284C2AEBE8C57776661867FC9.D20A184973A7353310B86E6EE5EBB29FBF77D3BB&sparams=asr_langs%2Ccaps%2Cv%2Cexpire&key=yttt1&asr_langs=nl%2Cja%2Cen%2Cpt%2Cko%2Cde%2Cru%2Cfr%2Cit%2Ces&v=gBu21qdGDl4&expire=1423226740&type=track&lang=en&name&kind=asr&fmt=1, exploding that out gives:

caps: "asr"
asr_langs: "nl,ja,en,pt,ko,de,ru,fr,it,es"
expire: "1423226740"
fmt: "1"
hl: "en-GB"
key: "yttt1"
kind: "asr"
lang: "en"
name: "undefined"
signature: "26433C4A5DD34B3284C2AEBE8C57776661867FC9.D20A184973A7353310B86E6EE5EBB29FBF77D3BB"
sparams: "asr_langs,caps,v,expire"
type: "track"
v: "gBu21qdGDl4"

So it looks like google have added a bunch of required parameters to the URL. Is there any known way around this?

Yep, youtube changed their API yet another time, so this script is really outdated. I'm going to write a note in the description.

It seems they over complicated the API. Youtube requires the app to be registered, and I can't even find documentation in their API about the subtitles..

I'm not planning on fixing this anytime soon. If you want to fix it just let me know.

OK thanks, that's what I suspected.

I found out you can download them with youtube-dl, with the --write-auto-sub argument.

Hey, I didn't know that youtube-dl could also download subs. That's good news. I will update the description with that info. Thanks

In case anyone else is interested in this and solely downloading the captions, not the video, youtube-dl can be used like:
youtube-dl --write-auto-sub --skip-download [some url]