mirror of
https://github.com/TeamNewPipe/NewPipeExtractor.git
synced 2025-04-27 23:40:36 +05:30
cache player js code
This commit is contained in:
parent
fcdb9bdbeb
commit
a189f685dc
@ -16,13 +16,16 @@ public class YoutubeThrottlingDecoder {
|
|||||||
|
|
||||||
private static final String HTTPS = "https:";
|
private static final String HTTPS = "https:";
|
||||||
private static final String N_PARAM_REGEX = "[&?]n=([^&]+)";
|
private static final String N_PARAM_REGEX = "[&?]n=([^&]+)";
|
||||||
|
private static String playerJsCode;
|
||||||
|
|
||||||
private final String functionName;
|
private final String functionName;
|
||||||
private final String function;
|
private final String function;
|
||||||
|
|
||||||
public YoutubeThrottlingDecoder(String videoId, Localization localization) throws ParsingException {
|
public YoutubeThrottlingDecoder(String videoId, Localization localization) throws ParsingException {
|
||||||
String playerJsUrl = cleanPlayerJsUrl(extractPlayerJsUrl(videoId, localization));
|
if (playerJsCode == null) {
|
||||||
String playerJsCode = downloadPlayerJsCode(localization, playerJsUrl);
|
String playerJsUrl = cleanPlayerJsUrl(extractPlayerJsUrl(videoId, localization));
|
||||||
|
playerJsCode = downloadPlayerJsCode(localization, playerJsUrl);
|
||||||
|
}
|
||||||
|
|
||||||
functionName = parseDecodeFunctionName(playerJsCode);
|
functionName = parseDecodeFunctionName(playerJsCode);
|
||||||
function = parseDecodeFunction(playerJsCode, functionName);
|
function = parseDecodeFunction(playerJsCode, functionName);
|
||||||
|
@ -534,7 +534,6 @@ 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 " + 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…
x
Reference in New Issue
Block a user