[YouTube] Fix throttling parameter decryption on Android

Escape the curly brace in the regular expression used to parse the throttling
parameter decryption function to allow its compatibility on Android.
This commit is contained in:
ThetaDev 2022-09-09 10:49:26 +02:00 committed by AudricV
parent 6a858368c8
commit 4905f74700
No known key found for this signature in database
GPG Key ID: DA92EC7905614198
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