mirror of
https://github.com/TeamNewPipe/NewPipeExtractor.git
synced 2024-12-13 13:50:33 +05:30
fix ogg
This commit is contained in:
parent
644da4fc3c
commit
d0efe8bd47
@ -121,6 +121,8 @@ public class MediaCCCStreamExtractor extends StreamExtractor {
|
|||||||
mediaFormat = MediaFormat.OPUS;
|
mediaFormat = MediaFormat.OPUS;
|
||||||
} else if(mimeType.endsWith("mpeg")) {
|
} else if(mimeType.endsWith("mpeg")) {
|
||||||
mediaFormat = MediaFormat.MP3;
|
mediaFormat = MediaFormat.MP3;
|
||||||
|
} else if(mimeType.endsWith("ogg")){
|
||||||
|
mediaFormat = MediaFormat.OGG;
|
||||||
} else {
|
} else {
|
||||||
throw new ExtractionException("Unknown media format: " + mimeType);
|
throw new ExtractionException("Unknown media format: " + mimeType);
|
||||||
}
|
}
|
||||||
@ -146,8 +148,6 @@ public class MediaCCCStreamExtractor extends StreamExtractor {
|
|||||||
mediaFormat = MediaFormat.WEBM;
|
mediaFormat = MediaFormat.WEBM;
|
||||||
} else if(mimeType.endsWith("mp4")) {
|
} else if(mimeType.endsWith("mp4")) {
|
||||||
mediaFormat = MediaFormat.MPEG_4;
|
mediaFormat = MediaFormat.MPEG_4;
|
||||||
} else if(mimeType.endsWith("ogg")){
|
|
||||||
mediaFormat = MediaFormat.OGG;
|
|
||||||
} else {
|
} else {
|
||||||
throw new ExtractionException("Unknown media format: " + mimeType);
|
throw new ExtractionException("Unknown media format: " + mimeType);
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,42 @@
|
|||||||
|
package org.schabi.newpipe.extractor.services.media_ccc;
|
||||||
|
|
||||||
|
import org.junit.BeforeClass;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.schabi.newpipe.Downloader;
|
||||||
|
import org.schabi.newpipe.extractor.NewPipe;
|
||||||
|
import org.schabi.newpipe.extractor.services.media_ccc.extractors.MediaCCCStreamExtractor;
|
||||||
|
import org.schabi.newpipe.extractor.stream.AudioStream;
|
||||||
|
import org.schabi.newpipe.extractor.stream.StreamExtractor;
|
||||||
|
import org.schabi.newpipe.extractor.utils.Localization;
|
||||||
|
|
||||||
|
|
||||||
|
import static junit.framework.TestCase.assertEquals;
|
||||||
|
import static org.schabi.newpipe.extractor.ServiceList.MediaCCC;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test {@link MediaCCCStreamExtractor}
|
||||||
|
*/
|
||||||
|
public class MediaCCCOggTest {
|
||||||
|
// test against https://api.media.ccc.de/public/events/1317
|
||||||
|
private static StreamExtractor extractor;
|
||||||
|
|
||||||
|
@BeforeClass
|
||||||
|
public static void setUpClass() throws Exception {
|
||||||
|
NewPipe.init(Downloader.getInstance(), new Localization("GB", "en"));
|
||||||
|
|
||||||
|
extractor = MediaCCC.getStreamExtractor("https://api.media.ccc.de/public/events/1317");
|
||||||
|
extractor.fetchPage();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getAudioStreamsCount() throws Exception {
|
||||||
|
assertEquals(1, extractor.getAudioStreams().size());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getAudioStreamsContainOgg() throws Exception {
|
||||||
|
for(AudioStream stream : extractor.getAudioStreams()) {
|
||||||
|
System.out.println(stream.getFormat());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -30,7 +30,7 @@ public class MediaCCCSearchExtractorAllTest {
|
|||||||
public static void setUpClass() throws Exception {
|
public static void setUpClass() throws Exception {
|
||||||
NewPipe.init(Downloader.getInstance(), new Localization("GB", "en"));
|
NewPipe.init(Downloader.getInstance(), new Localization("GB", "en"));
|
||||||
extractor = MediaCCC.getSearchExtractor( new MediaCCCSearchQueryHandlerFactory()
|
extractor = MediaCCC.getSearchExtractor( new MediaCCCSearchQueryHandlerFactory()
|
||||||
.fromQuery("c", Arrays.asList(new String[] {"all"}), "")
|
.fromQuery("c3", Arrays.asList(new String[] {"all"}), "")
|
||||||
,new Localization("GB", "en"));
|
,new Localization("GB", "en"));
|
||||||
extractor.fetchPage();
|
extractor.fetchPage();
|
||||||
itemsPage = extractor.getInitialPage();
|
itemsPage = extractor.getInitialPage();
|
||||||
@ -40,6 +40,7 @@ public class MediaCCCSearchExtractorAllTest {
|
|||||||
public void testIfChannelInfoItemsAvailable() {
|
public void testIfChannelInfoItemsAvailable() {
|
||||||
boolean isAvialable = false;
|
boolean isAvialable = false;
|
||||||
for(InfoItem item : itemsPage.getItems()) {
|
for(InfoItem item : itemsPage.getItems()) {
|
||||||
|
System.out.println(item);
|
||||||
if(item instanceof ChannelInfoItem) {
|
if(item instanceof ChannelInfoItem) {
|
||||||
isAvialable = true;
|
isAvialable = true;
|
||||||
}
|
}
|
||||||
@ -51,6 +52,7 @@ public class MediaCCCSearchExtractorAllTest {
|
|||||||
public void testIfStreamInfoitemsAvailable() {
|
public void testIfStreamInfoitemsAvailable() {
|
||||||
boolean isAvialable = false;
|
boolean isAvialable = false;
|
||||||
for(InfoItem item : itemsPage.getItems()) {
|
for(InfoItem item : itemsPage.getItems()) {
|
||||||
|
System.out.println(item);
|
||||||
if(item instanceof StreamInfoItem) {
|
if(item instanceof StreamInfoItem) {
|
||||||
isAvialable = true;
|
isAvialable = true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user