From 0674fac93f56cd1dc27a7dc0bb83e593248046a6 Mon Sep 17 00:00:00 2001 From: "Bodhi Mulders (BeMacized)" Date: Fri, 28 Feb 2020 20:05:34 +0100 Subject: [PATCH] Fix url in cipher field not being used for content length retrieval --- lib/src/youtube_explode_base.dart | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/src/youtube_explode_base.dart b/lib/src/youtube_explode_base.dart index 113c9ad..958ff3b 100644 --- a/lib/src/youtube_explode_base.dart +++ b/lib/src/youtube_explode_base.dart @@ -66,7 +66,7 @@ class YoutubeExplode { var contentLength = await _parseContentLength( streamInfoJson['contentLength'], - urlString, + url?.toString(), ); // Extract container @@ -130,7 +130,7 @@ class YoutubeExplode { var contentLength = await _parseContentLength( streamInfoJson['contentLength'], - urlString, + url?.toString(), ); // Extract container @@ -424,11 +424,11 @@ class YoutubeExplode { String contentLengthString, String url) async { var contentLength = int.tryParse(contentLengthString ?? '') ?? -1; - if (contentLength <= 0) { + if (contentLength <= 0 && !url.isNullOrWhiteSpace) { contentLength = _contentLenExp?.firstMatch(url)?.group(1) ?? -1; } - if (contentLength <= 0) { + if (contentLength <= 0 && !url.isNullOrWhiteSpace) { contentLength = await _requestContentLength(url); }