add url to sout

This commit is contained in:
XiangRongLin 2021-07-15 20:05:06 +02:00
parent 80cf8b3acd
commit fcdb9bdbeb
2 changed files with 4 additions and 3 deletions

View File

@ -15,6 +15,7 @@ import java.util.regex.Pattern;
public class YoutubeThrottlingDecoder {
private static final String HTTPS = "https:";
private static final String N_PARAM_REGEX = "[&?]n=([^&]+)";
private final String functionName;
private final String function;
@ -85,7 +86,7 @@ public class YoutubeThrottlingDecoder {
}
public String parseNParam(String url) throws Parser.RegexException {
Pattern nValuePattern = Pattern.compile("[&?]n=([^&]+)");
Pattern nValuePattern = Pattern.compile(N_PARAM_REGEX);
return Parser.matchGroup1(nValuePattern, url);
}
@ -95,7 +96,7 @@ public class YoutubeThrottlingDecoder {
}
public String replaceNParam(String url, String newValue) {
Pattern nValuePattern = Pattern.compile("[&?]n=([^&]+)");
Pattern nValuePattern = Pattern.compile(N_PARAM_REGEX);
return nValuePattern.matcher(url).replaceFirst(newValue);
}
}

View File

@ -534,7 +534,7 @@ public class YoutubeStreamExtractor extends StreamExtractor {
String newNParam = throttlingDecoder.decodeNParam(oldNParam);
String newUrl = throttlingDecoder.replaceNParam(url, newNParam);
System.out.println("aaaaaa " + oldNParam + " - " + newNParam);
System.out.println("aaaaaa " + url + " - " + oldNParam + " - " + newNParam);
final VideoStream videoStream = new VideoStream(newUrl, false, itag);
if (!Stream.containSimilarStream(videoStream, videoStreams)) {
videoStreams.add(videoStream);