Add ChannelId property to Video class

This commit is contained in:
Hexah 2020-06-30 01:00:37 +02:00
parent eb139901e8
commit 1e0cd15782
8 changed files with 17 additions and 3 deletions

View File

@ -1,3 +1,6 @@
## 1.4.0
- Add ChannelId property to Video class.
## 1.3.3
- Error handling when using `getStream` if the connection fails. If it fails more than 5 times on the same request the exception will be thrown anyways.
- Caching of player source for 10 minutes.

View File

@ -59,7 +59,6 @@ Future<void> download(String id) async {
// Track the file download status.
var len = audio.size.totalBytes;
var count = 0;
var oldProgress = -1;
// Create the message and set the cursor position.
var msg = 'Downloading ${video.title}.${audio.container.name}';

View File

@ -49,6 +49,7 @@ class PlaylistClient {
VideoId(videoId),
video.title,
video.author,
video.authorId,
video.uploadDate,
video.description,
video.duration,

View File

@ -1,5 +1,6 @@
import 'dart:convert';
import '../../channels/channel_id.dart';
import '../../exceptions/exceptions.dart';
import '../../extensions/helpers_extension.dart';
import '../../retry.dart';
@ -64,6 +65,8 @@ class _Video {
String get author => _root['author'];
ChannelId get authorId => ChannelId('UC${_root['user_id']}');
DateTime get uploadDate =>
DateTime.fromMillisecondsSinceEpoch(_root['time_created'] * 1000);

View File

@ -6,7 +6,7 @@ export 'dash_manifest.dart';
export 'embed_page.dart';
export 'player_response.dart';
export 'player_source.dart';
export 'playerlist_response.dart';
export 'playlist_response.dart';
export 'stream_info_provider.dart';
export 'video_info_response.dart';
export 'watch_page.dart';

View File

@ -1,5 +1,5 @@
import '../common/common.dart';
import '../reverse_engineering/responses/playerlist_response.dart';
import '../reverse_engineering/responses/playlist_response.dart';
import '../reverse_engineering/youtube_http_client.dart';
import '../videos/video.dart';
import '../videos/video_id.dart';
@ -32,6 +32,7 @@ class SearchClient {
VideoId(videoId),
video.title,
video.author,
video.authorId,
video.uploadDate,
video.description,
video.duration,

View File

@ -2,6 +2,7 @@ import 'dart:collection';
import 'package:equatable/equatable.dart';
import '../channels/channel_id.dart';
import '../common/common.dart';
import '../reverse_engineering/responses/responses.dart';
import 'video_id.dart';
@ -20,6 +21,9 @@ class Video with EquatableMixin {
/// Video author.
final String author;
/// Video author Id.
final ChannelId channelId;
/// Video upload date.
final DateTime uploadDate;
@ -47,6 +51,7 @@ class Video with EquatableMixin {
this.id,
this.title,
this.author,
this.channelId,
this.uploadDate,
this.description,
this.duration,

View File

@ -1,3 +1,4 @@
import '../channels/channel_id.dart';
import '../common/common.dart';
import '../reverse_engineering/responses/responses.dart';
import '../reverse_engineering/youtube_http_client.dart';
@ -36,6 +37,7 @@ class VideoClient {
videoId,
playerResponse.videoTitle,
playerResponse.videoAuthor,
ChannelId(playerResponse.videoChannelId),
playerResponse.videoUploadDate,
playerResponse.videoDescription,
playerResponse.videoDuration,