From d6c1f8f02e6167cbb50b92f995269b99a2cdff06 Mon Sep 17 00:00:00 2001 From: Mattia Date: Tue, 21 Jul 2020 14:01:40 +0200 Subject: [PATCH] Fix decipherer https://github.com/Tyrrrz/YoutubeExplode/commit/6ca05ef566dd4e4503515d7aacb5787e122446d0 --- CHANGELOG.md | 8 +++++++- lib/src/reverse_engineering/responses/player_source.dart | 6 +++--- pubspec.yaml | 2 +- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9a94330..cbafab2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,14 @@ -## 1.4.2 +## 1.4.2 - WIP - Implement `getSrt` a video closed captions in srt format. - Only throw custom exceptions from the library. - `getUploadsFromPage` no longer throws. +## 1.4.1+3 +- Fix decipherer + +## 1.4.1+2 +- Implement Container.toString() + ## 1.4.1+1 - Bug fixes diff --git a/lib/src/reverse_engineering/responses/player_source.dart b/lib/src/reverse_engineering/responses/player_source.dart index 2129ecf..da7176d 100644 --- a/lib/src/reverse_engineering/responses/player_source.dart +++ b/lib/src/reverse_engineering/responses/player_source.dart @@ -12,7 +12,7 @@ class PlayerSource { final RegExp _funcBodyExp = RegExp( r'(\w+)=function\(\w+\){(\w+)=\2\.split\(\x22{2}\);.*?return\s+\2\.join\(\x22{2}\)}'); - final RegExp _funcNameExp = RegExp(r'(\w+).\w+\(\w+,\d+\);'); + final RegExp _objNameExp = RegExp(r'([\$_\w]+).\w+\(\w+,\d+\);'); final RegExp _calledFuncNameExp = RegExp(r'\w+(?:.|\[)(\"?\w+(?:\")?)\]?\('); @@ -95,11 +95,11 @@ class PlayerSource { } String _getDeciphererDefinitionBody(String deciphererFuncBody) { - var funcName = _funcNameExp.firstMatch(deciphererFuncBody).group(1); + var objName = _objNameExp.firstMatch(deciphererFuncBody).group(1); var exp = RegExp( r'var\s+' - '${RegExp.escape(funcName)}' + '${RegExp.escape(objName)}' r'=\{(\w+:function\(\w+(,\w+)?\)\{(.*?)\}),?\};', dotAll: true); return exp.firstMatch(_root).group(0).nullIfWhitespace; diff --git a/pubspec.yaml b/pubspec.yaml index 645b57b..0575131 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -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.4.1+2 +version: 1.4.1+3 homepage: https://github.com/Hexer10/youtube_explode_dart environment: