Fix the fetch of the playerCode at each time getStsFromPlayerJs is called
storePlayerJs was called even if sts was not empty in the getStsFromPlayerJs method. This commit fixes it.
This commit is contained in:
parent
ae5abc0c5d
commit
b52732a1c3
|
@ -829,14 +829,11 @@ public class YoutubeStreamExtractor extends StreamExtractor {
|
||||||
} else {
|
} else {
|
||||||
// Fallback to the desktop JSON player endpoint
|
// Fallback to the desktop JSON player endpoint
|
||||||
|
|
||||||
if (sts == null) {
|
|
||||||
sts = getStsFromPlayerJs();
|
|
||||||
}
|
|
||||||
|
|
||||||
// The cipher signatures from the player endpoint without a timestamp are invalid so
|
// The cipher signatures from the player endpoint without a timestamp are invalid so
|
||||||
// download it again only if we didn't have a signatureTimestamp before fetching the
|
// download it again only if we didn't have a signatureTimestamp before fetching the
|
||||||
// data of this video (the sts string).
|
// data of this video (the sts string).
|
||||||
if (!stsKnown) {
|
if (!stsKnown) {
|
||||||
|
sts = getStsFromPlayerJs();
|
||||||
final JsonObject playerResponseWithSignatureTimestamp = getJsonPostResponse(
|
final JsonObject playerResponseWithSignatureTimestamp = getJsonPostResponse(
|
||||||
"player", createPlayerBodyWithSts(localization, contentCountry, videoId),
|
"player", createPlayerBodyWithSts(localization, contentCountry, videoId),
|
||||||
localization);
|
localization);
|
||||||
|
@ -1027,6 +1024,7 @@ public class YoutubeStreamExtractor extends StreamExtractor {
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getStsFromPlayerJs() throws ParsingException {
|
private String getStsFromPlayerJs() throws ParsingException {
|
||||||
|
if (!isNullOrEmpty(sts)) return sts;
|
||||||
if (playerCode == null) {
|
if (playerCode == null) {
|
||||||
storePlayerJs();
|
storePlayerJs();
|
||||||
if (playerCode == null) throw new ParsingException("playerCode is null");
|
if (playerCode == null) throw new ParsingException("playerCode is null");
|
||||||
|
|
Loading…
Reference in New Issue