add url to sout
This commit is contained in:
parent
80cf8b3acd
commit
fcdb9bdbeb
2 changed files with 4 additions and 3 deletions
|
@ -15,6 +15,7 @@ import java.util.regex.Pattern;
|
||||||
public class YoutubeThrottlingDecoder {
|
public class YoutubeThrottlingDecoder {
|
||||||
|
|
||||||
private static final String HTTPS = "https:";
|
private static final String HTTPS = "https:";
|
||||||
|
private static final String N_PARAM_REGEX = "[&?]n=([^&]+)";
|
||||||
|
|
||||||
private final String functionName;
|
private final String functionName;
|
||||||
private final String function;
|
private final String function;
|
||||||
|
@ -85,7 +86,7 @@ public class YoutubeThrottlingDecoder {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String parseNParam(String url) throws Parser.RegexException {
|
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);
|
return Parser.matchGroup1(nValuePattern, url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,7 +96,7 @@ public class YoutubeThrottlingDecoder {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String replaceNParam(String url, String newValue) {
|
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);
|
return nValuePattern.matcher(url).replaceFirst(newValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -534,7 +534,7 @@ public class YoutubeStreamExtractor extends StreamExtractor {
|
||||||
String newNParam = throttlingDecoder.decodeNParam(oldNParam);
|
String newNParam = throttlingDecoder.decodeNParam(oldNParam);
|
||||||
String newUrl = throttlingDecoder.replaceNParam(url, newNParam);
|
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);
|
final VideoStream videoStream = new VideoStream(newUrl, false, itag);
|
||||||
if (!Stream.containSimilarStream(videoStream, videoStreams)) {
|
if (!Stream.containSimilarStream(videoStream, videoStreams)) {
|
||||||
videoStreams.add(videoStream);
|
videoStreams.add(videoStream);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue