Address PR request. #8
This commit is contained in:
parent
e9b67691ef
commit
94ea6a88b0
|
@ -231,7 +231,7 @@ class YoutubeExplode {
|
||||||
videoInfo['shortDescription'],
|
videoInfo['shortDescription'],
|
||||||
ThumbnailSet(videoId),
|
ThumbnailSet(videoId),
|
||||||
Duration(seconds: int.parse(videoInfo['lengthSeconds'])),
|
Duration(seconds: int.parse(videoInfo['lengthSeconds'])),
|
||||||
videoInfo['keywords']?.cast<String>(),
|
videoInfo['keywords']?.cast<String>() ?? const <String>[],
|
||||||
Statistics(int.parse(videoInfo['viewCount']), 0, 0));
|
Statistics(int.parse(videoInfo['viewCount']), 0, 0));
|
||||||
|
|
||||||
var streamingData = playerResponseJson['streamingData'];
|
var streamingData = playerResponseJson['streamingData'];
|
||||||
|
@ -297,7 +297,7 @@ class YoutubeExplode {
|
||||||
var author = details['author'];
|
var author = details['author'];
|
||||||
var description = details['shortDescription'];
|
var description = details['shortDescription'];
|
||||||
var duration = Duration(seconds: int.parse(details['lengthSeconds']));
|
var duration = Duration(seconds: int.parse(details['lengthSeconds']));
|
||||||
var keyWords = details['keywords']?.cast<String>();
|
var keyWords = details['keywords']?.cast<String>() ?? const <String>[];
|
||||||
var viewCount = int.tryParse(details['viewCount'] ?? '0') ?? 0;
|
var viewCount = int.tryParse(details['viewCount'] ?? '0') ?? 0;
|
||||||
|
|
||||||
var videoPageHtml = await _getVideoWatchPageHtml(videoId);
|
var videoPageHtml = await _getVideoWatchPageHtml(videoId);
|
||||||
|
@ -345,11 +345,13 @@ class YoutubeExplode {
|
||||||
Future<int> _requestContentLength(String url) async {
|
Future<int> _requestContentLength(String url) async {
|
||||||
var resp;
|
var resp;
|
||||||
try {
|
try {
|
||||||
resp = await http.head(url);
|
resp = await client.head(url);
|
||||||
} on Exception catch (e) {
|
} on Exception {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if (!resp.headers.containsKey('content-length')) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (!resp.headers.containsKey('content-length')) return -1;
|
|
||||||
String contentLengthString = resp.headers['content-length'];
|
String contentLengthString = resp.headers['content-length'];
|
||||||
return int.tryParse(contentLengthString ?? '') ?? -1;
|
return int.tryParse(contentLengthString ?? '') ?? -1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue