Merge pull request #11 from BeMacized/fix/content-length-cipher-url

Fix url in cipher field not being used for content length retrieval
This commit is contained in:
Mattia 2020-02-28 20:39:01 +01:00 committed by GitHub
commit a91648a873
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

@ -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);
}