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.
pull/604/head
TiA4f8R 2021-05-31 15:57:11 +02:00
rodzic ae5abc0c5d
commit b52732a1c3
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: E6D3E7F5949450DD
1 zmienionych plików z 2 dodań i 4 usunięć

Wyświetl plik

@ -829,14 +829,11 @@ public class YoutubeStreamExtractor extends StreamExtractor {
} else {
// 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
// download it again only if we didn't have a signatureTimestamp before fetching the
// data of this video (the sts string).
if (!stsKnown) {
sts = getStsFromPlayerJs();
final JsonObject playerResponseWithSignatureTimestamp = getJsonPostResponse(
"player", createPlayerBodyWithSts(localization, contentCountry, videoId),
localization);
@ -1027,6 +1024,7 @@ public class YoutubeStreamExtractor extends StreamExtractor {
}
private String getStsFromPlayerJs() throws ParsingException {
if (!isNullOrEmpty(sts)) return sts;
if (playerCode == null) {
storePlayerJs();
if (playerCode == null) throw new ParsingException("playerCode is null");