2020-12-27 01:03:08 +01:00
|
|
|
package org.schabi.newpipe.extractor.services.media_ccc;
|
|
|
|
|
2021-12-27 21:08:08 +01:00
|
|
|
import org.junit.jupiter.api.BeforeAll;
|
|
|
|
import org.junit.jupiter.api.Test;
|
2021-01-10 19:49:14 +01:00
|
|
|
import org.schabi.newpipe.downloader.DownloaderTestImpl;
|
2020-12-27 01:03:08 +01:00
|
|
|
import org.schabi.newpipe.extractor.NewPipe;
|
|
|
|
import org.schabi.newpipe.extractor.kiosk.KioskExtractor;
|
|
|
|
import org.schabi.newpipe.extractor.stream.StreamInfoItem;
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
2021-12-27 21:08:08 +01:00
|
|
|
import static org.junit.jupiter.api.Assertions.*;
|
2020-12-27 01:03:08 +01:00
|
|
|
import static org.schabi.newpipe.extractor.ServiceList.MediaCCC;
|
|
|
|
import static org.schabi.newpipe.extractor.utils.Utils.isNullOrEmpty;
|
|
|
|
|
|
|
|
public class MediaCCCRecentListExtractorTest {
|
|
|
|
private static KioskExtractor extractor;
|
|
|
|
|
2021-12-27 21:08:08 +01:00
|
|
|
@BeforeAll
|
2020-12-27 01:03:08 +01:00
|
|
|
public static void setUpClass() throws Exception {
|
|
|
|
NewPipe.init(DownloaderTestImpl.getInstance());
|
|
|
|
extractor = MediaCCC.getKioskList().getExtractorById("recent", null);
|
|
|
|
extractor.fetchPage();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
|
|
public void testStreamList() throws Exception {
|
|
|
|
final List<StreamInfoItem> items = extractor.getInitialPage().getItems();
|
|
|
|
assertEquals(100, items.size());
|
|
|
|
for (final StreamInfoItem item: items) {
|
|
|
|
assertFalse(isNullOrEmpty(item.getName()));
|
|
|
|
assertTrue(item.getDuration() > 0);
|
2021-03-25 19:44:44 +01:00
|
|
|
// Disabled for now, because sometimes videos are uploaded, but their release date is in the future
|
|
|
|
// assertTrue(item.getUploadDate().offsetDateTime().isBefore(OffsetDateTime.now()));
|
2020-12-27 01:03:08 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|