Merge remote-tracking branch 'origin/master'

This commit is contained in:
Mattia 2021-09-01 16:04:54 +02:00
commit c70ac16007
6 changed files with 27 additions and 11 deletions

View File

@ -26,14 +26,14 @@ class EmbeddedPlayerClient {
late final Iterable<_StreamInfo> muxedStreams = root
.get('streamingData')
?.getList('formats')
?.map((e) => _StreamInfo(e)) ??
?.map((e) => _StreamInfo(e, StreamSource.muxed)) ??
const [];
///
late final Iterable<_StreamInfo> adaptiveStreams = root
.get('streamingData')
?.getList('adaptiveFormats')
?.map((e) => _StreamInfo(e)) ??
?.map((e) => _StreamInfo(e, StreamSource.adaptive)) ??
const [];
///
@ -131,5 +131,9 @@ class _StreamInfo extends StreamInfoProvider {
@override
late final int? framerate = root['fps'] ?? 0;
_StreamInfo(this.root);
@override
final StreamSource source;
_StreamInfo(this.root, this.source);
}

View File

@ -47,6 +47,9 @@ class _StreamInfo extends StreamInfoProvider {
_StreamInfo(this.root);
@override
StreamSource get source => StreamSource.dash;
@override
late final int tag = int.parse(root.getAttribute('id')!);

View File

@ -1,8 +1,13 @@
enum StreamSource { muxed, adaptive, dash }
///
abstract class StreamInfoProvider {
///
static final RegExp contentLenExp = RegExp(r'clen=(\d+)');
///
StreamSource get source;
///
int get tag;

View File

@ -96,7 +96,7 @@ class PlayerResponse {
late final List<StreamInfoProvider> muxedStreams = root
.get('streamingData')
?.getList('formats')
?.map((e) => _StreamInfo(e))
?.map((e) => _StreamInfo(e, StreamSource.muxed))
.cast<StreamInfoProvider>()
.toList() ??
const <StreamInfoProvider>[];
@ -105,7 +105,7 @@ class PlayerResponse {
late final List<StreamInfoProvider> adaptiveStreams = root
.get('streamingData')
?.getList('adaptiveFormats')
?.map((e) => _StreamInfo(e))
?.map((e) => _StreamInfo(e, StreamSource.adaptive))
.cast<StreamInfoProvider>()
.toList() ??
const [];
@ -238,5 +238,8 @@ class _StreamInfo extends StreamInfoProvider {
return codecs.last;
}
_StreamInfo(this.root);
@override
final StreamSource source;
_StreamInfo(this.root, this.source);
}

View File

@ -156,9 +156,9 @@ class StreamsClient {
await _httpClient.getContentLength(url, validate: false) ??
0;
if (contentLength <= 0) {
continue;
}
// if (contentLength <= 0) {
// continue;
// }
// Common
var container = StreamContainer.parse(streamInfo.container!);
@ -184,7 +184,8 @@ class StreamsClient {
: videoQuality.toVideoResolution();
// Muxed
if (!audioCodec.isNullOrWhiteSpace) {
if (!audioCodec.isNullOrWhiteSpace &&
streamInfo.source != StreamSource.adaptive) {
streams[tag] = MuxedStreamInfo(
tag,
url,

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.10.6
version: 1.10.7-dev.1
homepage: https://github.com/Hexer10/youtube_explode_dart