-
Notifications
You must be signed in to change notification settings - Fork 417
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[media.ccc.de] Fix live streams extraction
The API was slightly changed and only HLS streams are provided anymore. Add a basic test for to check whether the required streamInfo fields are available. Closes #766
- Loading branch information
Showing
3 changed files
with
63 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
...java/org/schabi/newpipe/extractor/services/media_ccc/MediaCCCLiveStreamExtractorTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package org.schabi.newpipe.extractor.services.media_ccc; | ||
|
||
import org.junit.Assume; | ||
import org.junit.BeforeClass; | ||
import org.junit.Test; | ||
import org.schabi.newpipe.downloader.DownloaderTestImpl; | ||
import org.schabi.newpipe.extractor.InfoItem; | ||
import org.schabi.newpipe.extractor.NewPipe; | ||
import org.schabi.newpipe.extractor.kiosk.KioskExtractor; | ||
import org.schabi.newpipe.extractor.stream.StreamExtractor; | ||
import org.schabi.newpipe.extractor.stream.StreamInfo; | ||
|
||
import java.util.List; | ||
|
||
import static org.schabi.newpipe.extractor.ServiceList.MediaCCC; | ||
|
||
public class MediaCCCLiveStreamExtractorTest { | ||
|
||
private static KioskExtractor liveKiosk; | ||
private static StreamExtractor extractor; | ||
|
||
private static List<InfoItem> liveItems; | ||
|
||
@BeforeClass | ||
public static void setUp() throws Exception { | ||
NewPipe.init(DownloaderTestImpl.getInstance()); | ||
liveKiosk = MediaCCC.getKioskList().getExtractorById("live", null); | ||
liveKiosk.fetchPage(); | ||
liveItems = liveKiosk.getInitialPage().getItems(); | ||
Assume.assumeFalse( | ||
"Received an empty list of live streams. Skipping MediaCCCLiveStreamExtractorTest", | ||
liveItems.isEmpty()); | ||
} | ||
|
||
@Test | ||
public void testRequiredStreamInfo() throws Exception { | ||
// Try to get the StreamInfo for each live stream. | ||
// If some required info is not present an exception will be thrown | ||
// causing this test to fail. | ||
for (final InfoItem item : liveItems) { | ||
StreamInfo.getInfo(item.getUrl()); | ||
} | ||
} | ||
|
||
} |