Hexer10 / youtube_explode_dart

Dart library to interact with many Youtube APIs

Home Page:https://pub.dev/packages/youtube_explode_dart

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

getCaptionTracks() is not working

mayman007 opened this issue · comments

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):

  • Enviroment: Flutter
  • Version: 3.16
  • YoutubeExplode: 2.1.0
    Additional context
    I tried it a few months ago and it was working perfectly (I can't remember the exact YoutubeExplode's version but Flutter's version was probably 3.13)

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