Skip to content

Commit 58b09cf

Browse files
authored
Merge pull request #925 from Theta-Dev/fix-td-regex
[YouTube] Fix throttling parameter decryption on Android
2 parents 6a85836 + 4905f74 commit 58b09cf

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeThrottlingDecrypter.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,10 @@ private static String parseWithParenthesisMatching(final String playerJsCode,
137137
@Nonnull
138138
private static String parseWithRegex(final String playerJsCode, final String functionName)
139139
throws Parser.RegexException {
140-
final Pattern functionPattern = Pattern.compile(functionName + "=function(.*?};)\n",
140+
// Escape the curly end brace to allow compatibility with Android's regex engine
141+
// See https://stackoverflow.com/q/45074813
142+
//noinspection RegExpRedundantEscape
143+
final Pattern functionPattern = Pattern.compile(functionName + "=function(.*?\\};)\n",
141144
Pattern.DOTALL);
142145
return validateFunction("function "
143146
+ functionName

0 commit comments

Comments
 (0)