mirror of
https://github.com/TeamNewPipe/NewPipeExtractor.git
synced 2025-04-28 16:00:33 +05:30
[Soundcloud] Update SoundcloudStreamExtractorTest with latest changes
This commit is contained in:
parent
7607688cb0
commit
a336a8ca97
@ -24,6 +24,7 @@ import javax.annotation.Nullable;
|
|||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertSame;
|
import static org.junit.jupiter.api.Assertions.assertSame;
|
||||||
|
import static org.junit.jupiter.api.Assertions.fail;
|
||||||
import static org.schabi.newpipe.extractor.ServiceList.SoundCloud;
|
import static org.schabi.newpipe.extractor.ServiceList.SoundCloud;
|
||||||
|
|
||||||
public class SoundcloudStreamExtractorTest {
|
public class SoundcloudStreamExtractorTest {
|
||||||
@ -188,26 +189,33 @@ public class SoundcloudStreamExtractorTest {
|
|||||||
public void testAudioStreams() throws Exception {
|
public void testAudioStreams() throws Exception {
|
||||||
super.testAudioStreams();
|
super.testAudioStreams();
|
||||||
final List<AudioStream> audioStreams = extractor.getAudioStreams();
|
final List<AudioStream> audioStreams = extractor.getAudioStreams();
|
||||||
assertEquals(2, audioStreams.size());
|
assertEquals(3, audioStreams.size()); // 2 MP3 streams (1 progressive, 1 HLS) and 1 OPUS
|
||||||
audioStreams.forEach(audioStream -> {
|
audioStreams.forEach(audioStream -> {
|
||||||
final DeliveryMethod deliveryMethod = audioStream.getDeliveryMethod();
|
final DeliveryMethod deliveryMethod = audioStream.getDeliveryMethod();
|
||||||
final String mediaUrl = audioStream.getContent();
|
final String mediaUrl = audioStream.getContent();
|
||||||
if (audioStream.getFormat() == MediaFormat.OPUS) {
|
if (audioStream.getFormat() == MediaFormat.OPUS) {
|
||||||
// Assert that it's an OPUS 64 kbps media URL with a single range which comes
|
|
||||||
// from an HLS SoundCloud CDN
|
|
||||||
ExtractorAsserts.assertContains("-hls-opus-media.sndcdn.com", mediaUrl);
|
|
||||||
ExtractorAsserts.assertContains(".64.opus", mediaUrl);
|
|
||||||
assertSame(DeliveryMethod.HLS, deliveryMethod,
|
assertSame(DeliveryMethod.HLS, deliveryMethod,
|
||||||
"Wrong delivery method for stream " + audioStream.getId() + ": "
|
"Wrong delivery method for stream " + audioStream.getId() + ": "
|
||||||
+ deliveryMethod);
|
+ deliveryMethod);
|
||||||
} else if (audioStream.getFormat() == MediaFormat.MP3) {
|
// Assert it's an OPUS 64 kbps media playlist URL which comes from an HLS
|
||||||
// Assert that it's a MP3 128 kbps media URL which comes from a progressive
|
|
||||||
// SoundCloud CDN
|
// SoundCloud CDN
|
||||||
ExtractorAsserts.assertContains("-media.sndcdn.com/bKOA7Pwbut93.128.mp3",
|
ExtractorAsserts.assertContains("-hls-opus-media.sndcdn.com", mediaUrl);
|
||||||
mediaUrl);
|
ExtractorAsserts.assertContains(".64.opus", mediaUrl);
|
||||||
assertSame(DeliveryMethod.PROGRESSIVE_HTTP, deliveryMethod,
|
} else if (audioStream.getFormat() == MediaFormat.MP3) {
|
||||||
"Wrong delivery method for stream " + audioStream.getId() + ": "
|
if (deliveryMethod == DeliveryMethod.PROGRESSIVE_HTTP) {
|
||||||
+ deliveryMethod);
|
// Assert it's a MP3 128 kbps media URL which comes from a progressive
|
||||||
|
// SoundCloud CDN
|
||||||
|
ExtractorAsserts.assertContains("-media.sndcdn.com/bKOA7Pwbut93.128.mp3",
|
||||||
|
mediaUrl);
|
||||||
|
} else if (deliveryMethod == DeliveryMethod.HLS) {
|
||||||
|
// Assert it's a MP3 128 kbps media HLS playlist URL which comes from an HLS
|
||||||
|
// SoundCloud CDN
|
||||||
|
ExtractorAsserts.assertContains("-hls-media.sndcdn.com", mediaUrl);
|
||||||
|
ExtractorAsserts.assertContains(".128.mp3", mediaUrl);
|
||||||
|
} else {
|
||||||
|
fail("Wrong delivery method for stream " + audioStream.getId() + ": "
|
||||||
|
+ deliveryMethod);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user