2018-10-11 21:10:22 +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.Test;
|
2020-12-15 15:09:49 +01:00
|
|
|
import org.schabi.newpipe.downloader.DownloaderTestImpl;
|
2018-10-11 21:10:22 +02:00
|
|
|
import org.schabi.newpipe.extractor.NewPipe;
|
|
|
|
import org.schabi.newpipe.extractor.exceptions.ParsingException;
|
|
|
|
import org.schabi.newpipe.extractor.services.peertube.linkHandler.PeertubePlaylistLinkHandlerFactory;
|
|
|
|
|
2021-12-27 21:08:08 +01:00
|
|
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
|
|
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
2020-02-08 23:58:46 +01:00
|
|
|
|
2018-10-11 21:10:22 +02:00
|
|
|
/**
|
|
|
|
* Test for {@link PeertubePlaylistLinkHandlerFactory}
|
|
|
|
*/
|
|
|
|
public class PeertubePlaylistLinkHandlerFactoryTest {
|
|
|
|
|
|
|
|
private static PeertubePlaylistLinkHandlerFactory linkHandler;
|
|
|
|
|
2021-12-27 21:08:08 +01:00
|
|
|
@BeforeAll
|
2018-10-11 21:10:22 +02:00
|
|
|
public static void setUp() {
|
|
|
|
linkHandler = PeertubePlaylistLinkHandlerFactory.getInstance();
|
2019-11-19 22:38:17 +01:00
|
|
|
NewPipe.init(DownloaderTestImpl.getInstance());
|
2018-10-11 21:10:22 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
2020-01-15 14:27:52 +01:00
|
|
|
public void acceptUrlTest() throws ParsingException {
|
2020-04-09 17:51:51 +02:00
|
|
|
assertTrue(linkHandler.acceptUrl("https://framatube.org/videos/watch/playlist/d8ca79f9-e4c7-4269-8183-d78ed269c909"));
|
2021-11-03 13:35:30 +01:00
|
|
|
assertTrue(linkHandler.acceptUrl("https://framatube.org/w/p/d8ca79f9-e4c7-4269-8183-d78ed269c909"));
|
2020-04-09 17:51:51 +02:00
|
|
|
assertTrue(linkHandler.acceptUrl("https://framatube.org/videos/watch/playlist/d8ca79f9-e4c7-4269-8183-d78ed269c909/videos"));
|
|
|
|
assertTrue(linkHandler.acceptUrl("https://framatube.org/videos/watch/playlist/dacdc4ef-5160-4846-9b70-a655880da667"));
|
2021-11-03 13:35:30 +01:00
|
|
|
assertTrue(linkHandler.acceptUrl("https://framatube.org/w/p/dacdc4ef-5160-4846-9b70-a655880da667"));
|
2020-04-09 17:51:51 +02:00
|
|
|
assertTrue(linkHandler.acceptUrl("https://framatube.org/videos/watch/playlist/96b0ee2b-a5a7-4794-8769-58d8ccb79ab7"));
|
2021-11-03 13:35:30 +01:00
|
|
|
assertTrue(linkHandler.acceptUrl("https://framatube.org/w/p/96b0ee2b-a5a7-4794-8769-58d8ccb79ab7"));
|
2018-10-11 21:10:22 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
|
|
public void getIdFromUrl() throws ParsingException {
|
2020-04-09 17:51:51 +02:00
|
|
|
assertEquals("d8ca79f9-e4c7-4269-8183-d78ed269c909", linkHandler.getId("https://framatube.org/videos/watch/playlist/d8ca79f9-e4c7-4269-8183-d78ed269c909"));
|
2021-11-03 13:35:30 +01:00
|
|
|
assertEquals("d8ca79f9-e4c7-4269-8183-d78ed269c909", linkHandler.getId("https://framatube.org/w/p/d8ca79f9-e4c7-4269-8183-d78ed269c909"));
|
2020-04-09 17:51:51 +02:00
|
|
|
assertEquals("dacdc4ef-5160-4846-9b70-a655880da667", linkHandler.getId("https://framatube.org/videos/watch/playlist/dacdc4ef-5160-4846-9b70-a655880da667"));
|
2021-11-03 13:35:30 +01:00
|
|
|
assertEquals("dacdc4ef-5160-4846-9b70-a655880da667", linkHandler.getId("https://framatube.org/w/p/dacdc4ef-5160-4846-9b70-a655880da667"));
|
2020-04-09 17:51:51 +02:00
|
|
|
assertEquals("bfc145f5-1be7-48a6-9b9e-4f1967199dad", linkHandler.getId("https://framatube.org/videos/watch/playlist/bfc145f5-1be7-48a6-9b9e-4f1967199dad"));
|
2021-11-03 13:35:30 +01:00
|
|
|
assertEquals("bfc145f5-1be7-48a6-9b9e-4f1967199dad", linkHandler.getId("https://framatube.org/w/p/bfc145f5-1be7-48a6-9b9e-4f1967199dad"));
|
2020-04-09 17:51:51 +02:00
|
|
|
assertEquals("96b0ee2b-a5a7-4794-8769-58d8ccb79ab7", linkHandler.getId("https://framatube.org/videos/watch/playlist/96b0ee2b-a5a7-4794-8769-58d8ccb79ab7"));
|
2021-11-03 13:35:30 +01:00
|
|
|
assertEquals("96b0ee2b-a5a7-4794-8769-58d8ccb79ab7", linkHandler.getId("https://framatube.org/w/p/96b0ee2b-a5a7-4794-8769-58d8ccb79ab7"));
|
2018-10-11 21:10:22 +02:00
|
|
|
}
|
2021-11-03 14:41:39 +01:00
|
|
|
|
|
|
|
@Test
|
|
|
|
public void getUrl() throws ParsingException {
|
|
|
|
System.out.println(linkHandler.fromUrl("https://framatube.org/videos/watch/playlist/d8ca79f9-e4c7-4269-8183-d78ed269c909").getUrl());;
|
|
|
|
System.out.println(linkHandler.fromUrl("https://framatube.org/w/p/d8ca79f9-e4c7-4269-8183-d78ed269c909").getUrl());;
|
|
|
|
System.out.println(linkHandler.fromUrl("https://framatube.org/w/p/sLFbqXsw7sPR3AfvqQSBZB").getUrl());;
|
|
|
|
}
|
2018-10-11 21:10:22 +02:00
|
|
|
}
|