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
322 stars 141 forks source link

don't know why i get this error....... #164

Closed RomjanHossain closed 3 years ago

RomjanHossain commented 3 years ago
   final Video video = await yt.videos.get(widget.id);
    final StreamManifest manifest =
        await yt.videos.streamsClient.getManifest(widget.id);
    final AudioOnlyStreamInfo audio = manifest.audioOnly.last;

if i add those above lines i get this error below!

Performing hot reload...                                        
Reloaded 1 of 1240 libraries in 868ms.
E/flutter ( 7094): [ERROR:flutter/lib/ui/ui_dart_state.cc(199)] Unhandled Exception: FatalFailureException: Failed to perform an HTTP request to YouTube due to a fatal failure.
E/flutter ( 7094): In most cases, this error indicates that YouTube most likely changed something, which broke the library.
E/flutter ( 7094): If this issue persists, please report it on the project's GitHub page.
E/flutter ( 7094): Request: GET https://youtube.com/get_video_info?video_id=WLT8wqWBgFE&el=embedded&eurl=https%3A%2F%2Fyoutube.googleapis.com%2Fv%2FWLT8wqWBgFE&hl=en&html5=1&c=TVHTML5&cver=6.20180913
E/flutter ( 7094): Response: (410)
E/flutter ( 7094): 
E/flutter ( 7094): #0      YoutubeHttpClient._validateResponse (package:youtube_explode_dart/src/reverse_engineering/youtube_http_client.dart:49:7)
E/flutter ( 7094): #1      YoutubeHttpClient.getString (package:youtube_explode_dart/src/reverse_engineering/youtube_http_client.dart:59:7)
E/flutter ( 7094): <asynchronous suspension>
E/flutter ( 7094): #2      VideoInfoResponse.get.<anonymous closure> (package:youtube_explode_dart/src/reverse_engineering/responses/video_info_response.dart:73:17)
E/flutter ( 7094): <asynchronous suspension>
E/flutter ( 7094): #3      retry (package:youtube_explode_dart/src/retry.dart:17:14)
E/flutter ( 7094): <asynchronous suspension>
E/flutter ( 7094): #4      VideoClient._getVideoFromWatchPage (package:youtube_explode_dart/src/videos/video_client.dart:32:9)
E/flutter ( 7094): <asynchronous suspension>
E/flutter ( 7094): #5      _MyDownloadProgressState.saveThumbnail (package:socialdownload/widgets/social_pages/yt/downloading.dart:80:25)
E/flutter ( 7094): <asynchronous suspension>
E/flutter ( 7094): 

Enviroment:

prateekmedia commented 3 years ago

The latest version is v1.10.6, upgrade your package version from pubspec.yaml

RomjanHossain commented 3 years ago

i update youtube_explode_dart *1.9.10 -to- 1.10.6 in pubspec.yaml file. then, dart pub get and got version solving failed~

Resolving dependencies... (1.5s)
Because every version of flutter from sdk depends on meta 1.3.0 and json_annotation >=4.1.0 depends on meta ^1.4.0, flutter from sdk is incompatible with json_annotation >=4.1.0.
And because youtube_explode_dart >=1.10.0 depends on freezed_annotation ^0.14.3 which depends on json_annotation ^4.1.0, flutter from sdk is incompatible with youtube_explode_dart >=1.10.0.
So, because ytdownload depends on both flutter any from sdk and youtube_explode_dart ^1.10.6, version solving failed.

my Dart SDK version: 2.13.4 and flutter is 2.2.3 stable. i think youtube_explode_dart: ^1.10.6 is not compatible with my SDK versions. and i don't wanna build my app in master or beta branch~

prateekmedia commented 3 years ago

Seems this is an issue with freezed ( https://github.com/rrousselGit/freezed/issues/485 )

To fix the issue until a new flutter version is release you can temporarily add this to your pubspec.yaml

dependency_overrides: 
  freezed_annotation: 0.14.2

_Originally posted by @Hexer10 in https://github.com/Hexer10/youtube_explode_dart/issues/148#issuecomment-888589014_

RomjanHossain commented 3 years ago

after adding

  youtube_explode_dart: ^1.10.6
  freezed_annotation: 0.14.3

i got this error


Resolving dependencies... (1.0s)
Because every version of flutter_test from sdk depends on meta 1.3.0 and json_annotation >=4.1.0 depends on meta ^1.4.0, flutter_test from sdk is incompatible with json_annotation >=4.1.0.
So, because ytdownload depends on both json_annotation ^4.1.0 and flutter_test any from sdk, version solving failed.

then i add this dependencies on pubspec.yaml file meta: ^1.4.0

and got this error

Because every version of flutter_test from sdk depends on meta 1.3.0 and ytdownload
  depends on meta ^1.4.0, flutter_test from sdk is forbidden.
So, because ytdownload depends on flutter_test any from sdk, version solving failed.

i tried to change json_annotation versions too but it doesn't help.

prateekmedia commented 3 years ago

Use json_annotation v4.0.1 and remove flutter_test if you don't use test in your app.

Hexer10 commented 3 years ago

Check the pinned issue: https://github.com/Hexer10/youtube_explode_dart/issues/148#issuecomment-888589014

Most likely you just need to add freezed_annotation: 0.14.2 to the dependecies_overrides, not dependencies.

If you are unable to make progress please share your pubspec.yaml.

RomjanHossain commented 3 years ago

Thanks @Hexer10 ! i just overrided meta and freezed_annotation and it solved the issue!

dependency_overrides:
  freezed_annotation: 0.14.3
  meta: ^1.4.0