Hey guys,
I was trying the Youtube Data API today and wanted to download captions of some videos, but couldn't make it work. Here is what I did, I picked a popular video and listed all captions, and then I picked the caption id that translated to English. It throws at YouTube.Captions.download call no matter what format parameter I use. Here is the detailed error "GoogleJsonResponseException: API call to youtube.captions.download failed with error: Unsupported Output Format" Did anyone encounter this issue? Any advice to resolve this?
function myFunction() {
var ret = YouTube.Captions.list(['id,snippet'], 'M7FIvfx5J10');
console.log(ret);
var obj = new Object();
obj['tlang'] = 'en';
obj['tfmt'] = 'ttml';
//sbv – SubViewer subtitle
//scc – Scenarist Closed Caption format
//srt – SubRip subtitle
//ttml – Timed Text Markup Language caption
//vtt – Web Video Text Tracks caption
var ret1 = YouTube.Captions.download('8yMV7mc691aTqjNxZ9zPHOdwpkL_e11j', obj);
console.log(ret1);
}