DominicMaas / youtube-extractor

YouTube stream extractor library for Dart. Based on YouTubeExplode by Tyrrrz.
MIT License
85 stars 27 forks source link

The method 'group' was called on null. #1

Closed davidgalarza closed 6 years ago

davidgalarza commented 6 years ago

It does not work anymore, I'm receiving the following error:

`11-06 21:24:03.694 27171-27237/? E/flutter: [ERROR:flutter/shell/common/shell.cc(181)] Dart Error: Unhandled exception: NoSuchMethodError: The method 'group' was called on null. Receiver: null Tried calling: group()

0 PlayerSourceParser.parseCipherOperations (package:youtube_extractor/src/internal/parsers/player_source_parser.dart:22)

#1      YouTubeExtractor._getVideoPlayerSourceAsync (package:youtube_extractor/youtube_extractor.dart:298)
<asynchronous suspension>
#2      YouTubeExtractor.getMediaStreamsAsync (package:youtube_extractor/youtube_extractor.dart:73)
<asynchronous suspension>
#3      _SyncScreenState.initState.<anonymous closure> (package:sounter/screens/Sync/sync.dart:126)
#4      _RootZone.runUnary (dart:async/zone.dart:1379)
#5      _FutureListener.handleValue (dart:async/future_impl.dart:129)
#6      Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:642)
#7      Future._propagateToListeners (dart:async/future_impl.dart:671)
#8      Future._complete (dart:async/future_impl.dart:476)
#9      _SyncCompleter.complete (dart:async/future_impl.dart:51)
#10     _AsyncAwaitCompleter.complete (dart:async/runtime/libasync_patch.dart:28)
#11     _completeOnAsyncReturn (dart:async/runtime/libasync_patch.dart:295)
#12     getSong (package:sounter/util/geniusApi.dart:0)
#13     _RootZone.runUnary (dart:async/zone.dart:1379)
#14     _FutureListener.handleValue (dart:async/future_impl.dart:129)
#15     Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:642)
#16     Future._propagateToListeners (dart:async/future_impl.dart:671)
#17     Future._complete (dart:async/future_impl.dart:476)
#18     _SyncCompleter.complete (dart:async/future_impl.dart:51)
#19     _AsyncAwaitCompleter.complete (dart:async/runtime/libasync_patch.dart:28)
#20     _completeOnAsyncReturn (dart:async/runtime/libasync_patch.dart:295)
#21     _withClient (package:http/http.dart:0)
#22     _RootZone.runUnary (dart:async/zone.dart:1379)
#23     _FutureListener.handleValue (dart:async/future_impl.dart:129)
#24     Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:642)
#25     Future._propagateToListeners (dart:async/future_impl.dart:671)
#26     Future._completeWithValue (dart:async/future_impl.dart:486)
#27     Future._asyncComplete.<anonymous closure> (dart:async/future_impl.dart:516)
#28     _microtaskLoop (dart:async/schedule_microtask.dart:41)
#29     _startMicrotaskLoop (dart:async/schedule_microtask.dart:50)

`

DominicMaas commented 6 years ago

There appears to have been a YouTube API change, same issue with the original code: https://github.com/Tyrrrz/YoutubeExplode/issues/179

DominicMaas commented 6 years ago

Looks like the folks at youtube-dl did this: https://github.com/rg3/youtube-dl/commit/2511eee215c2a66020ae927c86face826f48ba8e

DominicMaas commented 6 years ago

I think I may have fixed it, what video did it break on? (so I can test to see if it now works).

davidgalarza commented 6 years ago

This video: https://www.youtube.com/watch?v=Soa3gO7tL-c

davidgalarza commented 6 years ago

Or this video: https://www.youtube.com/watch?v=YQHsXMglC9A

DominicMaas commented 6 years ago

I've performed some tests with those videos (and a few others), everything seems to work. I'll publish a new version shortly for you to double check.

Edit: Published.

davidgalarza commented 6 years ago

Yes, I've verified it, this works perfectly.

DominicMaas commented 6 years ago

Awesome!

htetwaiyan commented 5 years ago

I change the regex in stream-info-parser line(16) to like that int.tryParse(RegExp(r'([a-zA-Z0-9_-]{11})').firstMatch(parseUrl()).group(1)); is workout

htetwaiyan commented 5 years ago

I want to know how to download with video and audio stream together