Version 1.9.9

Fix #134
This commit is contained in:
Mattia 2021-07-05 10:17:00 +02:00
parent d0baedf916
commit 9d50d205ec
4 changed files with 47 additions and 35 deletions

View File

@ -1,3 +1,6 @@
## 1.9.9
- Fix issue #134 (Error when getting the hls manifest from a livestream)
## 1.9.8+1
- Fix example

View File

@ -82,7 +82,7 @@ class StreamsClient {
final playerConfig = watchPage.playerConfig;
var playerResponse =
playerConfig?.playerResponse ?? watchPage.playerResponse;
watchPage.playerResponse ?? playerConfig?.playerResponse;
if (playerResponse == null) {
throw VideoUnplayableException.unplayable(videoId);
}
@ -235,9 +235,15 @@ class StreamsClient {
/// Gets the HTTP Live Stream (HLS) manifest URL
/// for the specified video (if it's a live video stream).
Future<String> getHttpLiveStreamUrl(VideoId videoId) async {
var videoInfoResponse =
await VideoInfoResponse.get(_httpClient, videoId.toString());
var playerResponse = videoInfoResponse.playerResponse;
final watchPage = await WatchPage.get(_httpClient, videoId.value);
final playerResponse = watchPage.playerResponse;
if (playerResponse == null) {
throw TransientFailureException(
'Couldn\'t extract the playerResponse from the Watch Page!');
}
if (!playerResponse.isVideoPlayable) {
throw VideoUnplayableException.unplayable(videoId,
reason: playerResponse.videoPlayabilityError ?? '');

View File

@ -1,6 +1,6 @@
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.9.8+1
version: 1.9.9
homepage: https://github.com/Hexer10/youtube_explode_dart

View File

@ -13,16 +13,19 @@ void main() {
group('Get streams manifest of any video', () {
for (final val in {
VideoId('9bZkp7q19f0'), // very popular
VideoId(
'SkRSXFQerZs'), // age restricted (embed allowed) - This is unplayable
VideoId('hySoCSoH-g8'), // age restricted (embed not allowed)
VideoId('_kmeFXjjGfk'), // embed not allowed (type 1)
VideoId('MeJVWBSsPAY'), // embed not allowed (type 2)
VideoId('5VGm0dczmHc'), // rating not allowed
VideoId('ZGdLIwrGHG8'), // unlisted
VideoId('rsAAeyAr-9Y'), // recording of a live stream
VideoId('AI7ULzgf8RU'), // has DASH manifest
VideoId('9bZkp7q19f0'), //Normal
VideoId('ZGdLIwrGHG8'), //Unlisted
VideoId('rsAAeyAr-9Y'), //LiveStreamRecording
VideoId('V5Fsj_sCKdg'), //ContainsHighQualityStreams
VideoId('AI7ULzgf8RU'), //ContainsDashManifest
VideoId('-xNN-bJQ4vI'), //Omnidirectional
VideoId('vX2vsvdq8nw'), //HighDynamicRange
VideoId('YltHGKX80Y8'), //ContainsClosedCaptions
VideoId('_kmeFXjjGfk'), //EmbedRestrictedByYouTube
VideoId('MeJVWBSsPAY'), //EmbedRestrictedByAuthor
VideoId('SkRSXFQerZs'), //AgeRestricted
VideoId('hySoCSoH-g8'), //AgeRestrictedEmbedRestricted
VideoId('5VGm0dczmHc'), //RatingDisabled
VideoId('-xNN-bJQ4vI'), // 360° video
}) {
test('VideoId - ${val.value}', () async {
@ -37,6 +40,13 @@ void main() {
throwsA(const TypeMatcher<VideoRequiresPurchaseException>()));
});
test('Get the hls manifest of a live stream', () async {
expect(
await yt!.videos.streamsClient
.getHttpLiveStreamUrl(VideoId('5qap5aO4i9A')),
isNotEmpty);
});
group('Stream of unavailable videos throws VideoUnavailableException', () {
for (final val in {VideoId('qld9w0b-1ao'), VideoId('pb_hHv3fByo')}) {
test('VideoId - ${val.value}', () {
@ -48,26 +58,19 @@ void main() {
group('Get specific stream of any playable video', () {
for (final val in {
VideoId('9bZkp7q19f0'),
// very popular
VideoId(
'SkRSXFQerZs'), // age restricted (embed allowed) - This is unplayable
VideoId('hySoCSoH-g8'),
// age restricted (embed not allowed)
VideoId('_kmeFXjjGfk'),
// embed not allowed (type 1)
VideoId('MeJVWBSsPAY'),
// embed not allowed (type 2)
// VideoId('5VGm0dczmHc'),
// rating not allowed
VideoId('ZGdLIwrGHG8'),
// unlisted
VideoId('rsAAeyAr-9Y'),
// recording of a live stream
VideoId('AI7ULzgf8RU'),
// has DASH manifest
VideoId('-xNN-bJQ4vI'),
// 360° video
VideoId('9bZkp7q19f0'), //Normal
VideoId('ZGdLIwrGHG8'), //Unlisted
VideoId('rsAAeyAr-9Y'), //LiveStreamRecording
VideoId('V5Fsj_sCKdg'), //ContainsHighQualityStreams
VideoId('AI7ULzgf8RU'), //ContainsDashManifest
VideoId('-xNN-bJQ4vI'), //Omnidirectional
VideoId('vX2vsvdq8nw'), //HighDynamicRange
VideoId('YltHGKX80Y8'), //ContainsClosedCaptions
VideoId('_kmeFXjjGfk'), //EmbedRestrictedByYouTube
VideoId('MeJVWBSsPAY'), //EmbedRestrictedByAuthor
VideoId('SkRSXFQerZs'), //AgeRestricted
VideoId('hySoCSoH-g8'), //AgeRestrictedEmbedRestricted
VideoId('5VGm0dczmHc'), //RatingDisabled
}) {
test('VideoId - ${val.value}', () async {
var manifest = await yt!.videos.streamsClient.getManifest(val);