title: Youtube v3 API captions downloading
body: <p>I'm trying to download captions from some videos on Youtube using their nuget package. Here's some code:</p>
  
  <pre><code>var request = _youtube.Search.List("snippet,id");
  request.Q = "Bill Gates";
  request.MaxResults = 50;
  request.Type = "video";
  var results = request.Execute();
  foreach (var result in results.Items)
  {
      var captionListRequest = _youtube.Captions.List("id,snippet", result.Id.VideoId);
      var captionListResponse = captionListRequest.Execute();
      var russianCaptions =
          captionListResponse.Items.FirstOrDefault(c =&gt; c.Snippet.Language.ToLower() == "ru");
      if (russianCaptions != null)
      {
          var downloadRequest = _youtube.Captions.Download(russianCaptions.Id);
          downloadRequest.Tfmt = CaptionsResource.DownloadRequest.TfmtEnum.Srt;
          var ms = new MemoryStream();
          downloadRequest.Download(ms);
      }
  }
  </code></pre>
  
  <p>When the Download method is called I'm getting a weird Newtonsoft.JSON Exception that says:</p>
  
  <pre><code>    Newtonsoft.Json.JsonReaderException: 'Unexpected character encountered while parsing value: T. Path '', line 0, position 0.'
     at Newtonsoft.Json.JsonTextReader.ParseValue()
  </code></pre>
  
  <p>I've read some other threads on captions downloading problems and have tried to change my authorization workflow: first I've tried to use just the ApiKey but then also tried OAuth. Here's how it looks now:</p>
  
  <pre><code> var credential = GoogleWebAuthorizationBroker.AuthorizeAsync(
      new ClientSecrets
      {
          ClientId = "CLIENT_ID",
          ClientSecret = "CLIENT_SECRET"
      },
      new[] { YouTubeService.Scope.YoutubeForceSsl },
      "user",
      CancellationToken.None,
      new FileDataStore("Youtube.CaptionsCrawler")).Result;
  
  _youtube = new YouTubeService(new BaseClientService.Initializer
  {
      ApplicationName = "LKS Captions downloader",
      HttpClientInitializer = credential
  });
  </code></pre>
  
  <p>So, is it even possible to do what I'm trying to achieve?</p>
  
  <p>P.S. I was able to dig deep into the youtube nuget package and as I see, the actual message, that I get (that Newtonsoft.JSON is trying to deserialize, huh!) is "<em>The permissions associated with the request are not sufficient to download the caption track. The request might not be properly authorized, or the video order might not have enabled third-party contributions for this caption.</em>"</p>
  
  <p>So, do I have to be the video owner to download captions? But if so, how do other programs like <a href="https://sourceforge.net/projects/google2srt/?source=typ_redirect" rel="noreferrer">Google2SRT</a> work?</p>