Merge branch 'master' into comments

This commit is contained in:
Mattia 2020-06-21 16:43:47 +02:00 committed by GitHub
commit 08f79324d5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 16 additions and 6 deletions

View File

@ -1,3 +1,9 @@
## 1.2.3
- Fix duplicated bytes when downloading a stream. See [#41][Comment41]
## 1.2.2
- Momentarily ignore `isRateLimited()` when getting streams.
## 1.2.1
- Fixed `SearchPage.nextPage`.
@ -113,3 +119,6 @@
- Fixed bug in #23
[Comment41]: https://github.com/Hexer10/youtube_explode_dart/issues/41#issuecomment-646974990

View File

@ -36,8 +36,8 @@ Future<void> download(String id) async {
var manifest = await yt.videos.streamsClient.getManifest(id);
var streams = manifest.audioOnly;
// Get the last audio track (the one with the highest bitrate).
var audio = streams.last;
// Get the audio track with the highest bitrate.
var audio = streams.withHighestBitrate();
var audioStream = yt.videos.streamsClient.get(audio);
// Compose the file name removing the unallowed characters in windows.

View File

@ -44,7 +44,7 @@ class YoutubeHttpClient extends http.BaseClient {
Future<String> getString(dynamic url,
{Map<String, String> headers, bool validate = true}) async {
var response = await get(url, headers: headers);
if (validate) {
_validateResponse(response, response.statusCode);
}
@ -75,6 +75,7 @@ class YoutubeHttpClient extends http.BaseClient {
return response.body;
}
// TODO: Check why isRateLimited is not working.
Stream<List<int>> getStream(StreamInfo streamInfo,
{Map<String, String> headers, bool validate = true}) async* {
var url = streamInfo.url;
@ -89,7 +90,7 @@ class YoutubeHttpClient extends http.BaseClient {
// } else {
for (var i = 0; i < streamInfo.size.totalBytes; i += 9898989) {
var request = http.Request('get', url);
request.headers['range'] = 'bytes=$i-${i + 9898989}';
request.headers['range'] = 'bytes=$i-${i + 9898989 - 1}';
var response = await send(request);
if (validate) {
_validateResponse(response, response.statusCode);

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.2.1
version: 1.2.3
homepage: https://github.com/Hexer10/youtube_explode_dart
environment:

View File

@ -15,7 +15,7 @@ void main() {
test('GetStreamsOfAnyVideo', () async {
var data = {
'9bZkp7q19f0',
// 'SkRSXFQerZs',
// 'SkRSXFQerZs', age restricted videos are not supported anymore.
'hySoCSoH-g8',
'_kmeFXjjGfk',
'MeJVWBSsPAY',