cache player js code
This commit is contained in:
parent
fcdb9bdbeb
commit
a189f685dc
2 changed files with 5 additions and 3 deletions
|
@ -16,13 +16,16 @@ public class YoutubeThrottlingDecoder {
|
|||
|
||||
private static final String HTTPS = "https:";
|
||||
private static final String N_PARAM_REGEX = "[&?]n=([^&]+)";
|
||||
private static String playerJsCode;
|
||||
|
||||
private final String functionName;
|
||||
private final String function;
|
||||
|
||||
public YoutubeThrottlingDecoder(String videoId, Localization localization) throws ParsingException {
|
||||
String playerJsUrl = cleanPlayerJsUrl(extractPlayerJsUrl(videoId, localization));
|
||||
String playerJsCode = downloadPlayerJsCode(localization, playerJsUrl);
|
||||
if (playerJsCode == null) {
|
||||
String playerJsUrl = cleanPlayerJsUrl(extractPlayerJsUrl(videoId, localization));
|
||||
playerJsCode = downloadPlayerJsCode(localization, playerJsUrl);
|
||||
}
|
||||
|
||||
functionName = parseDecodeFunctionName(playerJsCode);
|
||||
function = parseDecodeFunction(playerJsCode, functionName);
|
||||
|
|
|
@ -534,7 +534,6 @@ public class YoutubeStreamExtractor extends StreamExtractor {
|
|||
String newNParam = throttlingDecoder.decodeNParam(oldNParam);
|
||||
String newUrl = throttlingDecoder.replaceNParam(url, newNParam);
|
||||
|
||||
System.out.println("aaaaaa " + url + " - " + oldNParam + " - " + newNParam);
|
||||
final VideoStream videoStream = new VideoStream(newUrl, false, itag);
|
||||
if (!Stream.containSimilarStream(videoStream, videoStreams)) {
|
||||
videoStreams.add(videoStream);
|
||||
|
|
Loading…
Reference in a new issue