Version 1.7.2

Closes #86
This commit is contained in:
Mattia 2020-11-16 11:52:26 +01:00
parent 40873f5893
commit 14e4ad7bf6
8 changed files with 12 additions and 11 deletions

View File

@ -1,3 +1,7 @@
## 1.7.2
- Export Closed Captions Members.
- Fix #86
## 1.7.1 ## 1.7.1
- `ClosedCaptionTrackInfo` and it's members are now json serializable. - `ClosedCaptionTrackInfo` and it's members are now json serializable.

View File

@ -79,8 +79,8 @@ class ClosedCaptionClient {
/// Gets the actual closed caption track which is /// Gets the actual closed caption track which is
/// identified by the specified metadata. /// identified by the specified metadata.
Future<ClosedCaptionTrack> get(ClosedCaptionTrackInfo trackInfo) async { Future<ClosedCaptionTrack> get(ClosedCaptionTrackInfo trackInfo) async {
var response = await ClosedCaptionTrackResponse.get( var response =
_httpClient, trackInfo.url); await ClosedCaptionTrackResponse.get(_httpClient, trackInfo.url);
var captions = response.closedCaptions var captions = response.closedCaptions
.where((e) => !e.text.isNullOrWhiteSpace) .where((e) => !e.text.isNullOrWhiteSpace)

View File

@ -35,4 +35,4 @@ class ClosedCaptionFormat {
/// ///
Map<String, dynamic> toJson() => _$ClosedCaptionFormatToJson(this); Map<String, dynamic> toJson() => _$ClosedCaptionFormatToJson(this);
} }

View File

@ -31,10 +31,8 @@ class ClosedCaptionTrackInfo extends Equatable {
/// Keeping the same format. /// Keeping the same format.
ClosedCaptionTrackInfo autoTranslate(String lang) { ClosedCaptionTrackInfo autoTranslate(String lang) {
return ClosedCaptionTrackInfo( return ClosedCaptionTrackInfo(
url.replaceQueryParameters({'tlang': lang}), url.replaceQueryParameters({'tlang': lang}), Language(lang, ''),
Language(lang, ''), isAutoGenerated: isAutoGenerated, format: format);
isAutoGenerated: isAutoGenerated,
format: format);
} }
@override @override
@ -43,7 +41,6 @@ class ClosedCaptionTrackInfo extends Equatable {
@override @override
List<Object> get props => [url, language, isAutoGenerated]; List<Object> get props => [url, language, isAutoGenerated];
/// ///
factory ClosedCaptionTrackInfo.fromJson(Map<String, dynamic> json) => factory ClosedCaptionTrackInfo.fromJson(Map<String, dynamic> json) =>
_$ClosedCaptionTrackInfoFromJson(json); _$ClosedCaptionTrackInfoFromJson(json);

View File

@ -3,6 +3,7 @@
/// {@category Videos} /// {@category Videos}
library youtube_explode.videos; library youtube_explode.videos;
export 'closed_captions/closed_captions.dart';
export 'comments/comments.dart'; export 'comments/comments.dart';
export 'streams/streams.dart'; export 'streams/streams.dart';
export 'video.dart'; export 'video.dart';

View File

@ -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.7.1 version: 1.7.2
homepage: https://github.com/Hexer10/youtube_explode_dart homepage: https://github.com/Hexer10/youtube_explode_dart
environment: environment:

View File

@ -1,5 +1,4 @@
import 'package:test/test.dart'; import 'package:test/test.dart';
import 'package:youtube_explode_dart/src/videos/closed_captions/closed_caption_format.dart';
import 'package:youtube_explode_dart/youtube_explode_dart.dart'; import 'package:youtube_explode_dart/youtube_explode_dart.dart';
void main() { void main() {

View File

@ -32,7 +32,7 @@ void main() {
expect(video.thumbnails.highResUrl, isNotEmpty); expect(video.thumbnails.highResUrl, isNotEmpty);
expect(video.thumbnails.standardResUrl, isNotEmpty); expect(video.thumbnails.standardResUrl, isNotEmpty);
expect(video.thumbnails.maxResUrl, isNotEmpty); expect(video.thumbnails.maxResUrl, isNotEmpty);
expect(video.keywords, containsAll(['osu', 'mouse'/*, 'rhythm game'*/])); expect(video.keywords, containsAll(['osu', 'mouse' /*, 'rhythm game'*/]));
expect(video.engagement.viewCount, greaterThanOrEqualTo(134)); expect(video.engagement.viewCount, greaterThanOrEqualTo(134));
expect(video.engagement.likeCount, greaterThanOrEqualTo(5)); expect(video.engagement.likeCount, greaterThanOrEqualTo(5));
expect(video.engagement.dislikeCount, greaterThanOrEqualTo(0)); expect(video.engagement.dislikeCount, greaterThanOrEqualTo(0));