Skip to content

Commit b52732a

Browse files
committed
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.
1 parent ae5abc0 commit b52732a

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeStreamExtractor.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -829,14 +829,11 @@ private void fetchAndroidMobileJsonPlayer(final ContentCountry contentCountry,
829829
} else {
830830
// Fallback to the desktop JSON player endpoint
831831

832-
if (sts == null) {
833-
sts = getStsFromPlayerJs();
834-
}
835-
836832
// The cipher signatures from the player endpoint without a timestamp are invalid so
837833
// download it again only if we didn't have a signatureTimestamp before fetching the
838834
// data of this video (the sts string).
839835
if (!stsKnown) {
836+
sts = getStsFromPlayerJs();
840837
final JsonObject playerResponseWithSignatureTimestamp = getJsonPostResponse(
841838
"player", createPlayerBodyWithSts(localization, contentCountry, videoId),
842839
localization);
@@ -1027,6 +1024,7 @@ private String getDeobfuscationCode() throws ParsingException {
10271024
}
10281025

10291026
private String getStsFromPlayerJs() throws ParsingException {
1027+
if (!isNullOrEmpty(sts)) return sts;
10301028
if (playerCode == null) {
10311029
storePlayerJs();
10321030
if (playerCode == null) throw new ParsingException("playerCode is null");

0 commit comments

Comments
 (0)