New version 1.15.2

Fix extraction for same videos. This closes #76
This commit is contained in:
Mattia 2020-10-01 18:04:56 +02:00
parent d84e72a411
commit 0186ad3d7a
8 changed files with 14 additions and 8 deletions

View File

@ -3,6 +3,9 @@
- Only throw custom exceptions from the library.
- `getUploadsFromPage` no longer throws.
## 1.15.2
- Fix extraction for same videos (#76)
## 1.5.1
- Fix Video Search: https://github.com/Tyrrrz/YoutubeExplode/issues/438

View File

@ -10,7 +10,7 @@ import '../youtube_http_client.dart';
///
class EmbedPage {
static final _playerConfigExp =
RegExp(r"yt\.setConfig\({'PLAYER_CONFIG':(.*)}\);");
RegExp(r"'PLAYER_CONFIG':\s*(\{.*\})\}");
final Document _root;
_PlayerConfig _playerConfig;

View File

@ -30,7 +30,7 @@ class PlayerSource {
var val = RegExp(r'(?<=invalid namespace.*?;[\w\s]+=)\d+')
.stringMatch(_root)
?.nullIfWhitespace ??
RegExp(r'(?<=this\.signatureTimestamp=)\d+"')
RegExp(r'(?<=this\.signatureTimestamp=)\d+')
.stringMatch(_root)
?.nullIfWhitespace;
if (val == null) {

View File

@ -86,11 +86,13 @@ class WatchPage {
?.nullIfWhitespace ??
'0');
static final _playerConfigExp = RegExp(r'ytplayer\.config\s*=\s*(\{.*\}\});');
///
_PlayerConfig get playerConfig =>
_playerConfig ??= _PlayerConfig(json.decode(_matchJson(_extractJson(
_root.getElementsByTagName('html').first.text,
'ytplayer.config = '))));
_playerConfig ??= _PlayerConfig(json.decode(_playerConfigExp
.firstMatch(_root.getElementsByTagName('html').first.text)
?.group(1)));
String _extractJson(String html, String separator) {
return _matchJson(

View File

@ -218,6 +218,7 @@ class StreamsClient {
// We can try to extract the manifest from two sources:
// get_video_info and the video watch page.
// In some cases one works, in some cases another does.
try {
var context = await _getStreamContextFromVideoInfo(videoId);
return _getManifest(context);

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

View File

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

View File

@ -25,7 +25,7 @@ void main() {
expect(video.uploadDate.millisecondsSinceEpoch,
inInclusiveRange(rangeMs - 86400000, rangeMs + 86400000));
expect(video.description, contains('246pp'));
expect(video.duration, const Duration(minutes: 1, seconds: 49));
expect(video.duration, const Duration(minutes: 1, seconds: 48));
expect(video.thumbnails.lowResUrl, isNotEmpty);
expect(video.thumbnails.mediumResUrl, isNotEmpty);
expect(video.thumbnails.highResUrl, isNotEmpty);