parent
d84e72a411
commit
0186ad3d7a
|
@ -3,6 +3,9 @@
|
||||||
- Only throw custom exceptions from the library.
|
- Only throw custom exceptions from the library.
|
||||||
- `getUploadsFromPage` no longer throws.
|
- `getUploadsFromPage` no longer throws.
|
||||||
|
|
||||||
|
## 1.15.2
|
||||||
|
- Fix extraction for same videos (#76)
|
||||||
|
|
||||||
## 1.5.1
|
## 1.5.1
|
||||||
- Fix Video Search: https://github.com/Tyrrrz/YoutubeExplode/issues/438
|
- Fix Video Search: https://github.com/Tyrrrz/YoutubeExplode/issues/438
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ import '../youtube_http_client.dart';
|
||||||
///
|
///
|
||||||
class EmbedPage {
|
class EmbedPage {
|
||||||
static final _playerConfigExp =
|
static final _playerConfigExp =
|
||||||
RegExp(r"yt\.setConfig\({'PLAYER_CONFIG':(.*)}\);");
|
RegExp(r"'PLAYER_CONFIG':\s*(\{.*\})\}");
|
||||||
|
|
||||||
final Document _root;
|
final Document _root;
|
||||||
_PlayerConfig _playerConfig;
|
_PlayerConfig _playerConfig;
|
||||||
|
|
|
@ -30,7 +30,7 @@ class PlayerSource {
|
||||||
var val = RegExp(r'(?<=invalid namespace.*?;[\w\s]+=)\d+')
|
var val = RegExp(r'(?<=invalid namespace.*?;[\w\s]+=)\d+')
|
||||||
.stringMatch(_root)
|
.stringMatch(_root)
|
||||||
?.nullIfWhitespace ??
|
?.nullIfWhitespace ??
|
||||||
RegExp(r'(?<=this\.signatureTimestamp=)\d+"')
|
RegExp(r'(?<=this\.signatureTimestamp=)\d+')
|
||||||
.stringMatch(_root)
|
.stringMatch(_root)
|
||||||
?.nullIfWhitespace;
|
?.nullIfWhitespace;
|
||||||
if (val == null) {
|
if (val == null) {
|
||||||
|
|
|
@ -86,11 +86,13 @@ class WatchPage {
|
||||||
?.nullIfWhitespace ??
|
?.nullIfWhitespace ??
|
||||||
'0');
|
'0');
|
||||||
|
|
||||||
|
static final _playerConfigExp = RegExp(r'ytplayer\.config\s*=\s*(\{.*\}\});');
|
||||||
|
|
||||||
///
|
///
|
||||||
_PlayerConfig get playerConfig =>
|
_PlayerConfig get playerConfig =>
|
||||||
_playerConfig ??= _PlayerConfig(json.decode(_matchJson(_extractJson(
|
_playerConfig ??= _PlayerConfig(json.decode(_playerConfigExp
|
||||||
_root.getElementsByTagName('html').first.text,
|
.firstMatch(_root.getElementsByTagName('html').first.text)
|
||||||
'ytplayer.config = '))));
|
?.group(1)));
|
||||||
|
|
||||||
String _extractJson(String html, String separator) {
|
String _extractJson(String html, String separator) {
|
||||||
return _matchJson(
|
return _matchJson(
|
||||||
|
|
|
@ -218,6 +218,7 @@ class StreamsClient {
|
||||||
// We can try to extract the manifest from two sources:
|
// We can try to extract the manifest from two sources:
|
||||||
// get_video_info and the video watch page.
|
// get_video_info and the video watch page.
|
||||||
// In some cases one works, in some cases another does.
|
// In some cases one works, in some cases another does.
|
||||||
|
|
||||||
try {
|
try {
|
||||||
var context = await _getStreamContextFromVideoInfo(videoId);
|
var context = await _getStreamContextFromVideoInfo(videoId);
|
||||||
return _getManifest(context);
|
return _getManifest(context);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
name: youtube_explode_dart
|
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.
|
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
|
homepage: https://github.com/Hexer10/youtube_explode_dart
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
|
|
|
@ -14,7 +14,7 @@ void main() {
|
||||||
|
|
||||||
var data = {
|
var data = {
|
||||||
'9bZkp7q19f0',
|
'9bZkp7q19f0',
|
||||||
// 'SkRSXFQerZs', age restricted videos are not supported anymore.
|
'SkRSXFQerZs',
|
||||||
'hySoCSoH-g8',
|
'hySoCSoH-g8',
|
||||||
'_kmeFXjjGfk',
|
'_kmeFXjjGfk',
|
||||||
'MeJVWBSsPAY',
|
'MeJVWBSsPAY',
|
||||||
|
|
|
@ -25,7 +25,7 @@ void main() {
|
||||||
expect(video.uploadDate.millisecondsSinceEpoch,
|
expect(video.uploadDate.millisecondsSinceEpoch,
|
||||||
inInclusiveRange(rangeMs - 86400000, rangeMs + 86400000));
|
inInclusiveRange(rangeMs - 86400000, rangeMs + 86400000));
|
||||||
expect(video.description, contains('246pp'));
|
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.lowResUrl, isNotEmpty);
|
||||||
expect(video.thumbnails.mediumResUrl, isNotEmpty);
|
expect(video.thumbnails.mediumResUrl, isNotEmpty);
|
||||||
expect(video.thumbnails.highResUrl, isNotEmpty);
|
expect(video.thumbnails.highResUrl, isNotEmpty);
|
||||||
|
|
Loading…
Reference in New Issue