Minor bug fix.

If a channel in a search query doesn't provide a video count it will default to -1.
Fix #184
This commit is contained in:
Mattia 2022-01-11 13:54:30 +01:00
parent e19be09e7d
commit 2ecb634fe9
3 changed files with 13 additions and 8 deletions

View File

@ -210,17 +210,18 @@ class _InitialData extends InitialData {
}
if (content['channelRenderer'] != null) {
var renderer = content.get('channelRenderer')!;
return SearchChannel(
ChannelId(renderer.getT<String>('channelId')!),
renderer.get('title')!.getT<String>('simpleText')!,
renderer.get('descriptionSnippet')?.getList('runs')?.parseRuns() ??
'',
renderer
.get('videoCountText')!
.getList('runs')!
.first
.getT<String>('text')!
.parseInt()!);
.get('videoCountText')
?.getList('runs')
?.first
.getT<String>('text')
?.parseInt() ?? -1);
}
// Here ignore 'horizontalCardListRenderer' & 'shelfRenderer'
return null;

View File

@ -1,2 +1,2 @@
/// This i can either be a [SearchVideo] or [SearchPlaylist]
/// This can either be a [SearchVideo] or [SearchPlaylist]
mixin BaseSearchContent {}

View File

@ -1,8 +1,8 @@
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.10.9
version: 1.10.9+1
homepage: ^0.13.4
homepage: https://github.com/Hexer10/youtube_explode_dart
environment:
sdk: '>=2.14.0 <3.0.0'
@ -25,3 +25,7 @@ dev_dependencies:
json_serializable: ^6.1.1
lint: ^1.8.1
test: ^1.19.5
false_secrets:
- "lib/src/reverse_engineering/youtube_http_client.dart"
- "lib/src/reverse_engineering/clients/embedded_player_client.dart"