Only throw custom exceptions.
getUploadsFromPage no longer throws
This commit is contained in:
parent
c68f8d45f6
commit
e107c60581
|
@ -1,3 +1,7 @@
|
|||
## 1.4.2
|
||||
- Implement `getSrt` a video closed captions in srt format.
|
||||
- Only throw custom exceptions from the library.
|
||||
|
||||
## 1.4.1+1
|
||||
- Bug fixes
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ import 'dart:convert';
|
|||
|
||||
import 'package:html/dom.dart';
|
||||
import 'package:html/parser.dart' as parser;
|
||||
import 'package:youtube_explode_dart/src/exceptions/exceptions.dart';
|
||||
|
||||
import '../../channels/channel_video.dart';
|
||||
import '../../extensions/helpers_extension.dart';
|
||||
|
@ -106,7 +107,7 @@ class _InitialData {
|
|||
['items']
|
||||
.cast<Map<String, dynamic>>();
|
||||
}
|
||||
throw Exception('Couldn\'t find the content data');
|
||||
throw FatalFailureException('Failed to get initial data context.');
|
||||
}
|
||||
|
||||
Map<String, dynamic> getContinuationContext(Map<String, dynamic> root) {
|
||||
|
|
|
@ -3,6 +3,7 @@ import 'dart:convert';
|
|||
import 'package:html/dom.dart';
|
||||
import 'package:html/parser.dart' as parser;
|
||||
|
||||
import '../../../youtube_explode_dart.dart';
|
||||
import '../../extensions/helpers_extension.dart';
|
||||
import '../../playlists/playlist_id.dart';
|
||||
import '../../retry.dart';
|
||||
|
@ -131,7 +132,7 @@ class _InitialData {
|
|||
['itemSectionContinuation']['contents']
|
||||
.cast<Map<String, dynamic>>();
|
||||
}
|
||||
throw Exception('Couldn\'t find the content data');
|
||||
throw FatalFailureException('Failed to get initial data context.');
|
||||
}
|
||||
|
||||
Map<String, dynamic> getContinuationContext(Map<String, dynamic> root) {
|
||||
|
|
|
@ -44,12 +44,10 @@ class CommentsClient {
|
|||
/// a page contains at most 20 comments, use .take if you want to limit
|
||||
/// the results.
|
||||
///
|
||||
/// Throws an exception if the given video has not a watch page available.
|
||||
/// this happens for the videos from playlist or search queries.
|
||||
/// The streams doesn't emit any data if [Video.hasWatchPage] is false.
|
||||
Stream<Comment> getComments(Video video) async* {
|
||||
if (video.watchPage == null) {
|
||||
//TODO: Implement custom exception.
|
||||
throw Exception('Watch page not available for this video');
|
||||
return;
|
||||
}
|
||||
yield* _getComments(
|
||||
video.watchPage.initialData.continuation,
|
||||
|
|
|
@ -46,6 +46,9 @@ class Video with EquatableMixin {
|
|||
/// Shouldn't be used in the code.
|
||||
final WatchPage watchPage;
|
||||
|
||||
/// Returns true if the watch page is available for this video.
|
||||
bool get hasWatchPage => watchPage != null;
|
||||
|
||||
/// Initializes an instance of [Video]
|
||||
Video(
|
||||
this.id,
|
||||
|
|
Loading…
Reference in New Issue