Skip to content

Commit d13f531

Browse files
committed
Use YoutubeThrottlingDecrypter also in getAudioStreams and getVideoOnlyStreams methods of YoutubeStreamExtractor
Without this commit, the n param is only decrypted for streams extracted in getVideoStreams (so only for streams in the formats object of the player response).
1 parent 3205514 commit d13f531

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

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

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -500,11 +500,15 @@ public String getHlsUrl() throws ParsingException {
500500
public List<AudioStream> getAudioStreams() throws ExtractionException {
501501
assertPageFetched();
502502
final List<AudioStream> audioStreams = new ArrayList<>();
503+
final YoutubeThrottlingDecrypter throttlingDecrypter = new YoutubeThrottlingDecrypter(getId());
503504

504505
try {
505506
for (final Map.Entry<String, ItagItem> entry : getItags(ADAPTIVE_FORMATS, ItagItem.ItagType.AUDIO).entrySet()) {
506507
final ItagItem itag = entry.getValue();
507-
final AudioStream audioStream = new AudioStream(entry.getKey(), itag);
508+
String url = entry.getKey();
509+
url = throttlingDecrypter.apply(url);
510+
511+
final AudioStream audioStream = new AudioStream(url, itag);
508512
if (!Stream.containSimilarStream(audioStream, audioStreams)) {
509513
audioStreams.add(audioStream);
510514
}
@@ -544,11 +548,15 @@ public List<VideoStream> getVideoStreams() throws ExtractionException {
544548
public List<VideoStream> getVideoOnlyStreams() throws ExtractionException {
545549
assertPageFetched();
546550
final List<VideoStream> videoOnlyStreams = new ArrayList<>();
551+
final YoutubeThrottlingDecrypter throttlingDecrypter = new YoutubeThrottlingDecrypter(getId());
552+
547553
try {
548554
for (final Map.Entry<String, ItagItem> entry : getItags(ADAPTIVE_FORMATS, ItagItem.ItagType.VIDEO_ONLY).entrySet()) {
549555
final ItagItem itag = entry.getValue();
556+
String url = entry.getKey();
557+
url = throttlingDecrypter.apply(url);
550558

551-
final VideoStream videoStream = new VideoStream(entry.getKey(), true, itag);
559+
final VideoStream videoStream = new VideoStream(url, true, itag);
552560
if (!Stream.containSimilarStream(videoStream, videoOnlyStreams)) {
553561
videoOnlyStreams.add(videoStream);
554562
}

0 commit comments

Comments
 (0)