2020-04-09 17:51:51 +02:00
|
|
|
|
package org.schabi.newpipe.extractor.services.peertube;
|
|
|
|
|
|
2021-12-27 21:08:08 +01:00
|
|
|
|
import org.junit.jupiter.api.BeforeAll;
|
|
|
|
|
import org.junit.jupiter.api.Disabled;
|
|
|
|
|
import org.junit.jupiter.api.Test;
|
2020-12-15 15:09:49 +01:00
|
|
|
|
import org.schabi.newpipe.downloader.DownloaderTestImpl;
|
2021-02-12 22:57:51 +01:00
|
|
|
|
import org.schabi.newpipe.extractor.ExtractorAsserts;
|
2020-04-09 17:51:51 +02:00
|
|
|
|
import org.schabi.newpipe.extractor.NewPipe;
|
|
|
|
|
import org.schabi.newpipe.extractor.exceptions.ParsingException;
|
|
|
|
|
import org.schabi.newpipe.extractor.services.peertube.extractors.PeertubePlaylistExtractor;
|
|
|
|
|
|
2021-12-27 21:08:08 +01:00
|
|
|
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
2020-04-09 17:51:51 +02:00
|
|
|
|
import static org.schabi.newpipe.extractor.ServiceList.PeerTube;
|
|
|
|
|
|
|
|
|
|
public class PeertubePlaylistExtractorTest {
|
|
|
|
|
|
|
|
|
|
public static class Shocking {
|
|
|
|
|
private static PeertubePlaylistExtractor extractor;
|
|
|
|
|
|
2021-12-27 21:08:08 +01:00
|
|
|
|
@BeforeAll
|
2020-04-09 17:51:51 +02:00
|
|
|
|
public static void setUp() throws Exception {
|
|
|
|
|
NewPipe.init(DownloaderTestImpl.getInstance());
|
|
|
|
|
extractor = (PeertubePlaylistExtractor) PeerTube
|
|
|
|
|
.getPlaylistExtractor("https://framatube.org/videos/watch/playlist/96b0ee2b-a5a7-4794-8769-58d8ccb79ab7");
|
|
|
|
|
extractor.fetchPage();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void testGetName() throws ParsingException {
|
|
|
|
|
assertEquals("Shocking !", extractor.getName());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
2021-12-27 21:08:08 +01:00
|
|
|
|
@Disabled("URL changes with every request")
|
2020-04-09 17:51:51 +02:00
|
|
|
|
public void testGetThumbnailUrl() throws ParsingException {
|
|
|
|
|
assertEquals("https://framatube.org/static/thumbnails/playlist-96b0ee2b-a5a7-4794-8769-58d8ccb79ab7.jpg", extractor.getThumbnailUrl());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void testGetUploaderUrl() throws ParsingException {
|
|
|
|
|
assertEquals("https://skeptikon.fr/accounts/metadechoc", extractor.getUploaderUrl());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void testGetUploaderAvatarUrl() throws ParsingException {
|
|
|
|
|
assertEquals("https://framatube.org/lazy-static/avatars/cd0f781d-0287-4be2-94f1-24cd732337b2.jpg", extractor.getUploaderAvatarUrl());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void testGetUploaderName() throws ParsingException {
|
|
|
|
|
assertEquals("Méta de Choc", extractor.getUploaderName());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void testGetStreamCount() throws ParsingException {
|
2022-01-04 17:28:31 +01:00
|
|
|
|
ExtractorAsserts.assertGreaterOrEqual(39, extractor.getStreamCount());
|
2020-04-09 17:51:51 +02:00
|
|
|
|
}
|
2020-05-09 10:15:35 +02:00
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void testGetSubChannelUrl() throws ParsingException {
|
|
|
|
|
assertEquals("https://skeptikon.fr/video-channels/metadechoc_channel", extractor.getSubChannelUrl());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void testGetSubChannelName() throws ParsingException {
|
|
|
|
|
assertEquals("SHOCKING !", extractor.getSubChannelName());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void testGetSubChannelAvatarUrl() throws ParsingException {
|
|
|
|
|
assertEquals("https://framatube.org/lazy-static/avatars/f1dcd0e8-e651-42ed-ae81-bb3bd4aff2bc.png",
|
|
|
|
|
extractor.getSubChannelAvatarUrl());
|
|
|
|
|
}
|
2020-04-09 17:51:51 +02:00
|
|
|
|
}
|
|
|
|
|
}
|