Skip to content

Commit

Permalink
Revert "fix bug:cannot get any stream"
Browse files Browse the repository at this point in the history
This reverts commit 76d4683.
  • Loading branch information
fuzhengyin committed Apr 15, 2022
1 parent 76d4683 commit 3a909f6
Showing 1 changed file with 3 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ public class YoutubeThrottlingDecrypter {

private static final Pattern N_PARAM_PATTERN = Pattern.compile("[&?]n=([^&]+)");
private static final Pattern FUNCTION_NAME_PATTERN = Pattern.compile(
"b=a\\.get\\(\"n\"\\)\\)&&\\(b=(.+?)\\(b\\),a\\.set\\(\"n\",b\\)");
"b=a\\.get\\(\"n\"\\)\\)&&\\(b=(\\w+)\\(b\\),a\\.set\\(\"n\",b\\)");

private static final Map<String, String> nParams = new HashMap<>();

private final String functionName;
Expand Down Expand Up @@ -65,18 +66,7 @@ public YoutubeThrottlingDecrypter() throws ParsingException {

private String parseDecodeFunctionName(final String playerJsCode)
throws Parser.RegexException {
String functionName = Parser.matchGroup1(FUNCTION_NAME_PATTERN, playerJsCode);
if (functionName.contains("[")) {
int arrayStartBrace = functionName.indexOf("[");
String arrayVarName = functionName.substring(0, arrayStartBrace);
String order = functionName.substring(arrayStartBrace+1, functionName.indexOf("]"));
int arrayNum = Integer.parseInt(order);
Pattern ARRAY_PATTERN = Pattern.compile(String.format("var %s=\\[(.+?)\\];", arrayVarName));
String arrayString = Parser.matchGroup1(ARRAY_PATTERN, playerJsCode);
String names[] = arrayString.split(",");
functionName = names[arrayNum];
}
return functionName;
return Parser.matchGroup1(FUNCTION_NAME_PATTERN, playerJsCode);
}

@Nonnull
Expand Down

0 comments on commit 3a909f6

Please sign in to comment.