Merge pull request #925 from Theta-Dev/fix-td-regex

[YouTube] Fix throttling parameter decryption on Android
This commit is contained in:
AudricV 2022-09-10 23:30:50 +02:00 committed by GitHub
commit 58b09cf78b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -137,7 +137,10 @@ public final class YoutubeThrottlingDecrypter {
@Nonnull
private static String parseWithRegex(final String playerJsCode, final String functionName)
throws Parser.RegexException {
final Pattern functionPattern = Pattern.compile(functionName + "=function(.*?};)\n",
// Escape the curly end brace to allow compatibility with Android's regex engine
// See https://stackoverflow.com/q/45074813
//noinspection RegExpRedundantEscape
final Pattern functionPattern = Pattern.compile(functionName + "=function(.*?\\};)\n",
Pattern.DOTALL);
return validateFunction("function "
+ functionName