check wether mediaccc streams url are secure

This commit is contained in:
bopol 2020-03-13 20:07:36 +01:00
parent 0cd5e05b7b
commit 66518ec444
1 changed files with 23 additions and 4 deletions

View File

@ -7,11 +7,14 @@ import org.schabi.newpipe.DownloaderTestImpl;
import org.schabi.newpipe.extractor.NewPipe; import org.schabi.newpipe.extractor.NewPipe;
import org.schabi.newpipe.extractor.exceptions.ParsingException; import org.schabi.newpipe.extractor.exceptions.ParsingException;
import org.schabi.newpipe.extractor.services.media_ccc.extractors.MediaCCCStreamExtractor; import org.schabi.newpipe.extractor.services.media_ccc.extractors.MediaCCCStreamExtractor;
import org.schabi.newpipe.extractor.stream.AudioStream;
import org.schabi.newpipe.extractor.stream.VideoStream;
import org.schabi.newpipe.extractor.utils.UtilsTest; import org.schabi.newpipe.extractor.utils.UtilsTest;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Calendar; import java.util.Calendar;
import java.util.List;
import static java.util.Objects.requireNonNull; import static java.util.Objects.requireNonNull;
import static junit.framework.TestCase.assertEquals; import static junit.framework.TestCase.assertEquals;
@ -86,12 +89,20 @@ public class MediaCCCStreamExtractorTest {
@Test @Test
public void testVideoStreams() throws Exception { public void testVideoStreams() throws Exception {
assertEquals(4, extractor.getVideoStreams().size()); List<VideoStream> videoStreamList = extractor.getVideoStreams();
assertEquals(4, videoStreamList.size());
for (VideoStream stream : videoStreamList) {
assertIsSecureUrl(stream.getUrl());
}
} }
@Test @Test
public void testAudioStreams() throws Exception { public void testAudioStreams() throws Exception {
assertEquals(2, extractor.getAudioStreams().size()); List<AudioStream> audioStreamList = extractor.getAudioStreams();
assertEquals(2, audioStreamList.size());
for (AudioStream stream : audioStreamList) {
assertIsSecureUrl(stream.getUrl());
}
} }
@Test @Test
@ -164,12 +175,20 @@ public class MediaCCCStreamExtractorTest {
@Test @Test
public void testVideoStreams() throws Exception { public void testVideoStreams() throws Exception {
assertEquals(8, extractor.getVideoStreams().size()); List<VideoStream> videoStreamList = extractor.getVideoStreams();
assertEquals(8, videoStreamList.size());
for (VideoStream stream : videoStreamList) {
assertIsSecureUrl(stream.getUrl());
}
} }
@Test @Test
public void testAudioStreams() throws Exception { public void testAudioStreams() throws Exception {
assertEquals(2, extractor.getAudioStreams().size()); List<AudioStream> audioStreamList = extractor.getAudioStreams();
assertEquals(2, audioStreamList.size());
for (AudioStream stream : audioStreamList) {
assertIsSecureUrl(stream.getUrl());
}
} }
@Test @Test