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
315 stars 138 forks source link

[BUG] Explicit titles aka Videos that show "Viewer discretion is advised" results in streams are not available Error #299

Open KRTirtho opened 1 day ago

KRTirtho commented 1 day ago

Describe the bug Explicit titles or videos that show "Viewer discretion is advised" results in Streams not available error. e.g. Jake Hill & Josh A - Suicidal Thoughts does not work.

To Reproduce Include the code which doesn't work in the code markdown..

final yt = YoutubeExplode();

await yt.videos.streamsClient.getManifest("VFSg01HDqAk");

Stacktrace

----------------------------------------
[2024-10-17 12:03:33.819436]---------------------
VideoUnplayableException: Video 'VFSg01HDqAk' is unplayable.
Streams are not available for this video.
In most cases, this error indicates that there are 
some restrictions in place that prevent watching this video.
Reason: Please sign in
#0      StreamClient._getCipherStream (package:youtube_explode_dart/src/videos/streams/stream_client.dart:179)
<asynchronous suspension>
#1      StreamClient._getStreams (package:youtube_explode_dart/src/videos/streams/stream_client.dart:137)
<asynchronous suspension>
#2      Stream.toList.<anonymous closure> (dart:async/stream.dart:1351)
<asynchronous suspension>
#3      StreamClient.getManifest.<anonymous closure> (package:youtube_explode_dart/src/videos/streams/stream_client.dart:37)
<asynchronous suspension>
#4      retry (package:youtube_explode_dart/src/retry.dart:16)
<asynchronous suspension>
#5      Future.timeout.<anonymous closure> (dart:async/future_impl.dart:963)
<asynchronous suspension>
#6      YoutubeSourcedTrack.toSiblingType (package:spotube/services/sourced_track/sources/youtube.dart:145)
<asynchronous suspension>
#7      YoutubeSourcedTrack.fetchSiblings (package:spotube/services/sourced_track/sources/youtube.dart:239)
<asynchronous suspension>
#8      YoutubeSourcedTrack.fetchFromTrack (package:spotube/services/sourced_track/sources/youtube.dart:63)
<asynchronous suspension>
#9      SourcedTrack.fetchFromTrack (package:spotube/services/sourced_track/sourced_track.dart:117)
<asynchronous suspension>
#10     sourcedTrackProvider.<anonymous closure> (package:spotube/provider/server/sourced_track.dart:25)
<asynchronous suspension>
#11     FutureHandlerProviderElementMixin.handleFuture.<anonymous closure>.<anonymous closure> (package:riverpod/src/async_notifier/base.dart:348)
<asynchronous suspension>

Enviroment: (please complete the following information):

KRTirtho commented 1 day ago

Invidious API is able to get the streams of these types of videos. So, I guess there's a way around this. May be pretending to be different client device? https://inv.nadeko.net/watch?v=VFSg01HDqAk

Hexer10 commented 9 hours ago

I've just release a new version (2.3.2) which implements the tv client that should bypass that restriction, it should be used automatically. If the extraction fails the library automatically retries with the new client otherwise you can manually specify it:

  final manifest = await yt.videos.streams.getManifest('VFSg01HDqAk',
      ytClients: [
        YoutubeApiClient.tv
  ]);