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
324 stars 143 forks source link

Bug Report: Error Fetching Video Streams #312

Open ssss500 opened 1 day ago

ssss500 commented 1 day ago

Describe the bug

An error occurs when trying to fetch video streams using youtube_explode. The video is unavailable due to restrictions that require both logins. Note that they can work randomly. It can work once every 5 times, for example this is error :

Error fetching video qualities: VideoUnplayableException: Video 'PRPnNf-MoBw' is unplayable. Streams are not available for this video. Reason: Please sign in

[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: No video qualities found

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

import 'package:youtube_explode_dart/youtube_explode_dart.dart';

void fetchVideoStream(String videoId) async {
  var yt = YoutubeExplode();
  try {
    StreamManifest manifest = await yt.videos.streamsClient.getManifest(
      videoId,
      ytClients: [
        YoutubeApiClient.safari,
        YoutubeApiClient.mediaConnect,
      ],
    );
    // Process the manifest as needed
  } catch (e) {
    print('Error fetching video qualities: $e');
  }
}

Enviroment:

Hexer10 commented 1 day ago

Hi, unfortunately youtube lately has been limiting most clients, could you try adding YoutubeApiClient.tv and check if it helps?

ssss500 commented 1 day ago

Yes, it works and shows only 360 quality.

This is nice as a temporary solution.

Can we get a quality like 1080, for example, as before, soon?

Or should I look for a different way? Do you suggest an alternative solution that helps me upload a large number of videos and is free?

Hexer10 commented 19 hours ago

Unfortunately if you need muxed streams there is no other way to obtain them, YouTube has been blocking most clients that used to provide them.

You should get separate audio and video streams and merge them together if you need high quality streams.