Hexer10 / youtube_explode_dart

Dart library to interact with many Youtube APIs
https://pub.dev/packages/youtube_explode_dart
BSD 3-Clause "New" or "Revised" License
299 stars 122 forks source link

getCaptionTracks() is not working #270

Closed mayman007 closed 7 months ago

mayman007 commented 7 months ago

Describe the bug YouTubeCaptionScraper().getCaptionTracks() returns an error even if the video has captions

To Reproduce

final captionScraper = YouTubeCaptionScraper();
List<CaptionTrack> captionTracks = await captionScraper
        .getCaptionTracks('https://www.youtube.com/watch?v=XaqOejIaFgM');

Stacktrace

E/flutter (25417): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Null check operator used on a null value
E/flutter (25417): #0      YouTubeCaptionScraperImpl._parseCaptionTracks (package:youtube_caption_scraper/src/youtube_caption_scraper_impl.dart:51:49)
E/flutter (25417): #1      YouTubeCaptionScraperImpl.getCaptionTracks (package:youtube_caption_scraper/src/youtube_caption_scraper_impl.dart:43:14)
E/flutter (25417): <asynchronous suspension>
E/flutter (25417): #2      _VideoViewState.checkIfCaptionIsThere (package:shintube/src/views/video_view.dart:1097:40)
E/flutter (25417): <asynchronous suspension>
E/flutter (25417): 

Enviroment: (please complete the following information):

Hexer10 commented 7 months ago

Hi, you seem to be using another library youtube_caption_scraper, youtube_explode_dart does not provide any YouTubeCaptionScraper but there are other ways to get closed caption tracks, see: https://github.com/Hexer10/youtube_explode_dart?tab=readme-ov-file#extracting-closed-captions