Version 1.3.2
This commit is contained in:
parent
358dd52fa1
commit
fdd85a99fa
|
@ -1,3 +1,6 @@
|
||||||
|
## 1.3.2
|
||||||
|
- Minor caching changes.
|
||||||
|
|
||||||
## 1.3.1
|
## 1.3.1
|
||||||
- Implement caching of some results.
|
- Implement caching of some results.
|
||||||
|
|
||||||
|
|
|
@ -9,60 +9,40 @@ class PlayerResponse {
|
||||||
// Json parsed map
|
// Json parsed map
|
||||||
final Map<String, dynamic> _root;
|
final Map<String, dynamic> _root;
|
||||||
|
|
||||||
String _playerabilityStatus;
|
|
||||||
bool _isVideoAvailable;
|
|
||||||
bool _isVideoPlayable;
|
|
||||||
String _videoTitle;
|
|
||||||
String _videoAuthor;
|
|
||||||
DateTime _videoUploadDate;
|
|
||||||
String _videoChannelId;
|
|
||||||
Duration _videoDuration;
|
|
||||||
Iterable<String> _videoKeywords;
|
|
||||||
String _videoDescription;
|
|
||||||
int _videoViewCount;
|
|
||||||
String _previewVideoId;
|
|
||||||
bool _isLive;
|
|
||||||
String _hlsManifestUrl;
|
|
||||||
String _dashManifestUrl;
|
|
||||||
Iterable<StreamInfoProvider> _muxedStreams;
|
Iterable<StreamInfoProvider> _muxedStreams;
|
||||||
Iterable<StreamInfoProvider> _adaptiveStreams;
|
Iterable<StreamInfoProvider> _adaptiveStreams;
|
||||||
List<StreamInfoProvider> _streams;
|
List<StreamInfoProvider> _streams;
|
||||||
Iterable<ClosedCaptionTrack> _closedCaptionTrack;
|
Iterable<ClosedCaptionTrack> _closedCaptionTrack;
|
||||||
String _videoPlayabilityError;
|
String _videoPlayabilityError;
|
||||||
|
|
||||||
String get playabilityStatus =>
|
String get playabilityStatus => _root['playabilityStatus']['status'];
|
||||||
_playerabilityStatus ??= _root['playabilityStatus']['status'];
|
|
||||||
|
|
||||||
bool get isVideoAvailable =>
|
bool get isVideoAvailable => playabilityStatus.toLowerCase() != 'error';
|
||||||
_isVideoAvailable ??= playabilityStatus.toLowerCase() != 'error';
|
|
||||||
|
|
||||||
bool get isVideoPlayable =>
|
bool get isVideoPlayable => playabilityStatus.toLowerCase() == 'ok';
|
||||||
_isVideoAvailable ??= playabilityStatus.toLowerCase() == 'ok';
|
|
||||||
|
|
||||||
String get videoTitle => _videoTitle ??= _root['videoDetails']['title'];
|
String get videoTitle => _root['videoDetails']['title'];
|
||||||
|
|
||||||
String get videoAuthor => _videoAuthor ??= _root['videoDetails']['author'];
|
String get videoAuthor => _root['videoDetails']['author'];
|
||||||
|
|
||||||
DateTime get videoUploadDate => _videoUploadDate ??= DateTime.parse(
|
DateTime get videoUploadDate => DateTime.parse(
|
||||||
_root['microformat']['playerMicroformatRenderer']['uploadDate']);
|
_root['microformat']['playerMicroformatRenderer']['uploadDate']);
|
||||||
|
|
||||||
String get videoChannelId =>
|
String get videoChannelId => _root['videoDetails']['channelId'];
|
||||||
_videoChannelId ??= _root['videoDetails']['channelId'];
|
|
||||||
|
|
||||||
Duration get videoDuration => _videoDuration ??=
|
Duration get videoDuration =>
|
||||||
Duration(seconds: int.parse(_root['videoDetails']['lengthSeconds']));
|
Duration(seconds: int.parse(_root['videoDetails']['lengthSeconds']));
|
||||||
|
|
||||||
Iterable<String> get videoKeywords => _videoKeywords ??=
|
Iterable<String> get videoKeywords =>
|
||||||
_root['videoDetails']['keywords']?.cast<String>() ?? const [];
|
_root['videoDetails']['keywords']?.cast<String>() ?? const [];
|
||||||
|
|
||||||
String get videoDescription =>
|
String get videoDescription => _root['videoDetails']['shortDescription'];
|
||||||
_videoDescription ??= _root['videoDetails']['shortDescription'];
|
|
||||||
|
|
||||||
int get videoViewCount =>
|
int get videoViewCount => int.parse(_root['videoDetails']['viewCount']);
|
||||||
_videoViewCount ??= int.parse(_root['videoDetails']['viewCount']);
|
|
||||||
|
|
||||||
// Can be null
|
// Can be null
|
||||||
String get previewVideoId => _previewVideoId ??= _root
|
String get previewVideoId =>
|
||||||
|
_root
|
||||||
.get('playabilityStatus')
|
.get('playabilityStatus')
|
||||||
?.get('errorScreen')
|
?.get('errorScreen')
|
||||||
?.get('playerLegacyDesktopYpcTrailerRenderer')
|
?.get('playerLegacyDesktopYpcTrailerRenderer')
|
||||||
|
@ -75,15 +55,14 @@ class PlayerResponse {
|
||||||
?.getValue('playerVars') ??
|
?.getValue('playerVars') ??
|
||||||
'')['video_id'];
|
'')['video_id'];
|
||||||
|
|
||||||
bool get isLive =>
|
bool get isLive => _root.get('videoDetails')?.getValue('isLive') ?? false;
|
||||||
_isLive ??= _root.get('videoDetails')?.getValue('isLive') ?? false;
|
|
||||||
|
|
||||||
// Can be null
|
// Can be null
|
||||||
String get hlsManifestUrl => _hlsManifestUrl ??=
|
String get hlsManifestUrl =>
|
||||||
_root.get('streamingData')?.getValue('hlsManifestUrl');
|
_root.get('streamingData')?.getValue('hlsManifestUrl');
|
||||||
|
|
||||||
// Can be null
|
// Can be null
|
||||||
String get dashManifestUrl => _dashManifestUrl ??=
|
String get dashManifestUrl =>
|
||||||
_root.get('streamingData')?.getValue('dashManifestUrl');
|
_root.get('streamingData')?.getValue('dashManifestUrl');
|
||||||
|
|
||||||
Iterable<StreamInfoProvider> get muxedStreams => _muxedStreams ??= _root
|
Iterable<StreamInfoProvider> get muxedStreams => _muxedStreams ??= _root
|
||||||
|
@ -124,19 +103,13 @@ class ClosedCaptionTrack {
|
||||||
// Json parsed map
|
// Json parsed map
|
||||||
final Map<String, dynamic> _root;
|
final Map<String, dynamic> _root;
|
||||||
|
|
||||||
String _url;
|
String get url => _root['baseUrl'];
|
||||||
String _languageCode;
|
|
||||||
String _languageName;
|
|
||||||
bool _autoGenerated;
|
|
||||||
|
|
||||||
String get url => _url ??= _root['baseUrl'];
|
String get languageCode => _root['languageCode'];
|
||||||
|
|
||||||
String get languageCode => _languageCode ??= _root['languageCode'];
|
String get languageName => _root['name']['simpleText'];
|
||||||
|
|
||||||
String get languageName => _languageName ??= _root['name']['simpleText'];
|
bool get autoGenerated => _root['vssId'].toLowerCase().startsWith("a.");
|
||||||
|
|
||||||
bool get autoGenerated =>
|
|
||||||
_autoGenerated ??= _root['vssId'].toLowerCase().startsWith("a.");
|
|
||||||
|
|
||||||
ClosedCaptionTrack(this._root);
|
ClosedCaptionTrack(this._root);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import 'package:equatable/equatable.dart';
|
import 'package:equatable/equatable.dart';
|
||||||
import 'package:meta/meta.dart';
|
|
||||||
|
|
||||||
import '../../channels/channel_id.dart';
|
import '../../channels/channel_id.dart';
|
||||||
|
|
||||||
|
@ -27,11 +26,11 @@ class Comment with EquatableMixin {
|
||||||
final int replyCount;
|
final int replyCount;
|
||||||
|
|
||||||
/// Used internally.
|
/// Used internally.
|
||||||
@protected
|
/// Shouldn't be used in the code.
|
||||||
final String continuation;
|
final String continuation;
|
||||||
|
|
||||||
/// Used internally.
|
/// Used internally.
|
||||||
@protected
|
/// Shouldn't be used in the code.
|
||||||
final String clicktrackingParams;
|
final String clicktrackingParams;
|
||||||
|
|
||||||
/// Initializes an instance of [Comment]
|
/// Initializes an instance of [Comment]
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import 'dart:collection';
|
import 'dart:collection';
|
||||||
|
|
||||||
import 'package:equatable/equatable.dart';
|
import 'package:equatable/equatable.dart';
|
||||||
import 'package:meta/meta.dart';
|
|
||||||
|
|
||||||
import '../common/common.dart';
|
import '../common/common.dart';
|
||||||
import '../reverse_engineering/responses/responses.dart';
|
import '../reverse_engineering/responses/responses.dart';
|
||||||
|
@ -40,7 +39,7 @@ class Video with EquatableMixin {
|
||||||
final Engagement engagement;
|
final Engagement engagement;
|
||||||
|
|
||||||
/// Used internally.
|
/// Used internally.
|
||||||
@protected
|
/// Shouldn't be used in the code.
|
||||||
final WatchPage watchPage;
|
final WatchPage watchPage;
|
||||||
|
|
||||||
/// Initializes an instance of [Video]
|
/// Initializes an instance of [Video]
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
name: youtube_explode_dart
|
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.
|
description: A port in dart of the youtube explode library. Supports several API functions without the need of Youtube API Key.
|
||||||
version: 1.3.1
|
version: 1.3.2
|
||||||
homepage: https://github.com/Hexer10/youtube_explode_dart
|
homepage: https://github.com/Hexer10/youtube_explode_dart
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
|
|
Loading…
Reference in New Issue