Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] closedCaptions client does not work consistently #272

Open
AnhNgDo opened this issue Mar 22, 2024 · 0 comments
Open

[BUG] closedCaptions client does not work consistently #272

AnhNgDo opened this issue Mar 22, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@AnhNgDo
Copy link

AnhNgDo commented Mar 22, 2024

Describe the bug
When using closedCaptions client to obtain trackInfo, sometimes it doens't work for certain videos and an empty list of trackInfo is returned.

To Reproduce

// get all data from closedCaptions client
  final trackManifest = await yt.videos.closedCaptions.getManifest(videoId);
  // get data for English tracks
 // ISSUES: some time trackInfo is returned as an empty list. The videos are in English, with transcript available on youtube page. 
  final trackInfo = trackManifest.getByLanguage('en');
  // error if can't get track data
  if (trackInfo.isEmpty) throw StateError('Could not get Caption Track Info');
  // get the first tack based on 1st track data
  final track = await yt.videos.closedCaptions.get(trackInfo.first);
  // combine all texts from track's captions
  final String captionText =
      track.captions.map((caption) => caption.text).join(' ');
@AnhNgDo AnhNgDo added the bug Something isn't working label Mar 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant