diff --git a/example/video_download.dart b/example/video_download.dart index c1dab83..8a5bdf2 100644 --- a/example/video_download.dart +++ b/example/video_download.dart @@ -67,6 +67,7 @@ Future download(String id) async { // Listen for data received. var progressBar = ProgressBar(); await for (var data in audioStream) { + // Keep track of the current downloaded data. count += data.length; diff --git a/lib/src/reverse_engineering/responses/watch_page.dart b/lib/src/reverse_engineering/responses/watch_page.dart index 3db2071..4e260d9 100644 --- a/lib/src/reverse_engineering/responses/watch_page.dart +++ b/lib/src/reverse_engineering/responses/watch_page.dart @@ -222,9 +222,9 @@ class _PlayerConfig { class _InitialData { // Json parsed map - final Map _root; + final Map root; - _InitialData(this._root); + _InitialData(this.root); /* Cache results */ @@ -232,16 +232,16 @@ class _InitialData { String _clickTrackingParams; Map getContinuationContext(Map root) { - if (_root['contents'] != null) { - return (_root['contents']['twoColumnWatchNextResults']['results'] + if (root['contents'] != null) { + return (root['contents']['twoColumnWatchNextResults']['results'] ['results']['contents'] as List) ?.firstWhere((e) => e.containsKey('itemSectionRenderer'))[ 'itemSectionRenderer']['continuations'] ?.first['nextContinuationData'] ?.cast(); } - if (_root['response'] != null) { - return _root['response']['itemSectionContinuation']['continuations'] + if (root['response'] != null) { + return root['response']['itemSectionContinuation']['continuations'] ?.first['nextContinuationData'] ?.cast(); } @@ -249,8 +249,8 @@ class _InitialData { } String get continuation => _continuation ??= - getContinuationContext(_root)?.getValue('continuation') ?? ''; + getContinuationContext(root)?.getValue('continuation') ?? ''; String get clickTrackingParams => _clickTrackingParams ??= - getContinuationContext(_root)?.getValue('clickTrackingParams') ?? ''; + getContinuationContext(root)?.getValue('clickTrackingParams') ?? ''; } diff --git a/lib/src/videos/comments/comments.dart b/lib/src/videos/comments/comments.dart index 0726ef9..f7e6886 100644 --- a/lib/src/videos/comments/comments.dart +++ b/lib/src/videos/comments/comments.dart @@ -1 +1,2 @@ export 'comment.dart'; +export 'comments_client.dart'; \ No newline at end of file