From 407ac50f2249bcd09dfacbe2a456fab40c246e05 Mon Sep 17 00:00:00 2001 From: Hexah Date: Fri, 5 Jun 2020 16:17:08 +0200 Subject: [PATCH] Update for v5 --- analysis_options.yaml | 1 + example/example.dart | 2 + lib/src/channels/channel_client.dart | 8 +- lib/src/channels/channel_id.dart | 11 ++- lib/src/channels/username.dart | 16 ++-- .../exceptions/fatal_failure_exception.dart | 4 +- .../transient_failure_exception.dart | 1 + .../video_unavailable_exception.dart | 1 + .../video_unplayable_exception.dart | 1 + lib/src/extensions/helpers_extension.dart | 24 ++++- lib/src/playlists/playlist_client.dart | 2 +- lib/src/playlists/playlist_id.dart | 17 +++- lib/src/reverse_engineering/heuristics.dart | 2 +- .../responses/channel_page.dart | 8 +- .../responses/dash_manifest.dart | 14 ++- .../responses/embed_page.dart | 6 +- .../responses/player_response.dart | 92 +++++++++--------- .../responses/player_source.dart | 15 +-- .../responses/playerlist_response.dart | 22 ++--- .../responses/stream_info_provider.dart | 4 +- .../responses/watch_page.dart | 93 ++++++++++--------- .../youtube_http_client.dart | 34 +++++-- .../closed_caption_manifest.dart | 2 +- .../streams/audio_only_stream_info.dart | 5 +- lib/src/videos/streams/audio_stream_info.dart | 6 +- lib/src/videos/streams/bitrate.dart | 6 +- lib/src/videos/streams/filesize.dart | 1 - lib/src/videos/streams/framerate.dart | 8 +- lib/src/videos/streams/muxed_stream_info.dart | 1 + lib/src/videos/streams/stream_info.dart | 2 +- lib/src/videos/streams/stream_manifest.dart | 6 +- lib/src/videos/streams/streams_client.dart | 10 +- lib/src/videos/streams/video_resolution.dart | 4 +- lib/src/videos/streams/video_stream_info.dart | 9 +- lib/src/videos/video.dart | 3 +- lib/src/videos/video_id.dart | 10 +- pubspec.yaml | 4 - test/channel_id_test.dart | 35 +++++++ test/channel_test.dart | 74 +++++++++++++++ test/closed_caption_test.dart | 1 + test/playlist_id_test.dart | 59 ++++++++++++ test/playlist_test.dart | 83 +++++++++++++++++ test/search_test.dart | 1 + test/streams_test.dart | 70 ++++++++++++++ test/test.dart | 47 ---------- test/user_name_test.dart | 35 +++++++ test/video_id_test.dart | 41 ++++++++ test/video_test.dart | 57 ++++++++++++ tools/t2.dart | 5 + tools/test.dart | 52 +++++++++-- 50 files changed, 754 insertions(+), 261 deletions(-) create mode 100644 test/channel_id_test.dart create mode 100644 test/channel_test.dart create mode 100644 test/closed_caption_test.dart create mode 100644 test/playlist_id_test.dart create mode 100644 test/playlist_test.dart create mode 100644 test/search_test.dart create mode 100644 test/streams_test.dart delete mode 100644 test/test.dart create mode 100644 test/user_name_test.dart create mode 100644 test/video_id_test.dart create mode 100644 test/video_test.dart create mode 100644 tools/t2.dart diff --git a/analysis_options.yaml b/analysis_options.yaml index e54b130..4995189 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -14,6 +14,7 @@ linter: - prefer_constructors_over_static_methods - prefer_contains - annotate_overrides + - await_futures analyzer: exclude: diff --git a/example/example.dart b/example/example.dart index 08a8cf3..3f0d43c 100644 --- a/example/example.dart +++ b/example/example.dart @@ -3,8 +3,10 @@ import 'package:youtube_explode_dart/youtube_explode_dart.dart'; Future main() async { var yt = YoutubeExplode(); var video = await yt.videos.get(VideoId('https://www.youtube.com/watch?v=bo_efYhYU2A')); + var streamManifest = await yt.videos.streamsClient.getManifest(VideoId('https://www.youtube.com/watch?v=bo_efYhYU2A')); print('Title: ${video.title}'); + print(streamManifest.streams()); // Close the YoutubeExplode's http client. yt.close(); diff --git a/lib/src/channels/channel_client.dart b/lib/src/channels/channel_client.dart index eb883d3..370aa7a 100644 --- a/lib/src/channels/channel_client.dart +++ b/lib/src/channels/channel_client.dart @@ -1,6 +1,8 @@ import '../extensions/helpers_extension.dart'; +import '../playlists/playlists.dart'; import '../reverse_engineering/responses/responses.dart'; import '../reverse_engineering/youtube_http_client.dart'; +import '../videos/video.dart'; import '../videos/video_id.dart'; import 'channel.dart'; import 'channel_id.dart'; @@ -40,8 +42,8 @@ class ChannelClient { } /// Enumerates videos uploaded by the specified channel. - void getUploads(ChannelId id) async { - var playlist = 'UU${id.value.substringAfter('UC')}'; - //TODO: Finish this after playlist + Stream