Version v1.9.7

Fix #135
This commit is contained in:
Mattia 2021-06-28 11:54:17 +02:00
parent 0565dd0b07
commit 4562de0ded
4 changed files with 27 additions and 10 deletions

View File

@ -1,7 +1,10 @@
## 1.9.7
- Fix issue #135 (Cannot use getUploadsFromPage on a channel with no uploads).
## 1.9.6
- Fix comment client.
- Fix issue #130 (ClosedCaptions)
- Fix
## 1.9.5
- Temporary for issue #130

View File

@ -93,13 +93,20 @@ class _InitialData {
late final String token = continuationContext?.getT<String>('token') ?? '';
late final List<ChannelVideo> uploads =
getContentContext().map(_parseContent).whereNotNull().toList();
late final List<ChannelVideo> uploads = _getUploads();
List<ChannelVideo> _getUploads() {
final content = getContentContext();
if (content.isEmpty) {
return const <ChannelVideo>[];
}
return content.map(_parseContent).whereNotNull().toList();
}
List<Map<String, dynamic>> getContentContext() {
List<Map<String, dynamic>>? context;
if (root.containsKey('contents')) {
context = root
final render = root
.get('contents')
?.get('twoColumnBrowseResultsRenderer')
?.getList('tabs')
@ -112,10 +119,17 @@ class _InitialData {
?.firstOrNull
?.get('itemSectionRenderer')
?.getList('contents')
?.firstOrNull
?.get('gridRenderer')
?.getList('items')
?.cast<Map<String, dynamic>>();
?.firstOrNull;
if (render?.containsKey('gridRenderer') ?? false) {
context = render
?.get('gridRenderer')
?.getList('items')
?.cast<Map<String, dynamic>>();
} else if (render?.containsKey('messageRenderer') ?? false) {
// Workaround for no-videos.
context = const [];
}
}
if (context == null && root.containsKey('onResponseReceivedActions')) {
context = root

View File

@ -73,7 +73,7 @@ class Video with EquatableMixin {
this.engagement,
this.isLive, // ignore: avoid_positional_boolean_parameters
[this.watchPage])
: keywords = UnmodifiableListView(keywords ?? []);
: keywords = UnmodifiableListView(keywords ?? const []);
@override
String toString() => 'Video ($title)';

View File

@ -1,6 +1,6 @@
name: youtube_explode_dart
description: A port in dart of the youtube explode library. Supports several API functions without the need of Youtube API Key.
version: 1.9.6
version: 1.9.7
homepage: https://github.com/Hexer10/youtube_explode_dart