Skip to content

Commit 5f52325

Browse files
authored
Merge pull request #344 from B0pol/peertube_embeds
For #342: support PeerTube embeds
2 parents 3aa6b93 + 063f4be commit 5f52325

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

extractor/src/main/java/org/schabi/newpipe/extractor/services/peertube/linkHandler/PeertubeStreamLinkHandlerFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
public class PeertubeStreamLinkHandlerFactory extends LinkHandlerFactory {
1010

1111
private static final PeertubeStreamLinkHandlerFactory instance = new PeertubeStreamLinkHandlerFactory();
12-
private static final String ID_PATTERN = "/videos/(watch/)?([^/?&#]*)";
12+
private static final String ID_PATTERN = "/videos/(watch/|embed/)?([^/?&#]*)";
1313
private static final String VIDEO_ENDPOINT = "/api/v1/videos/";
1414

1515
private PeertubeStreamLinkHandlerFactory() {

extractor/src/test/java/org/schabi/newpipe/extractor/services/peertube/PeertubeStreamLinkHandlerFactoryTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,14 @@ public static void setUp() throws Exception {
2626
public void getId() throws Exception {
2727
assertEquals("986aac60-1263-4f73-9ce5-36b18225cb60", linkHandler.fromUrl("https://peertube.mastodon.host/videos/watch/986aac60-1263-4f73-9ce5-36b18225cb60").getId());
2828
assertEquals("986aac60-1263-4f73-9ce5-36b18225cb60", linkHandler.fromUrl("https://peertube.mastodon.host/videos/watch/986aac60-1263-4f73-9ce5-36b18225cb60?fsdafs=fsafa").getId());
29+
assertEquals("9c9de5e8-0a1e-484a-b099-e80766180a6d", linkHandler.fromUrl("https://framatube.org/videos/embed/9c9de5e8-0a1e-484a-b099-e80766180a6d").getId());
2930
}
3031

3132

3233
@Test
3334
public void testAcceptUrl() throws ParsingException {
3435
assertTrue(linkHandler.acceptUrl("https://peertube.mastodon.host/videos/watch/986aac60-1263-4f73-9ce5-36b18225cb60"));
3536
assertTrue(linkHandler.acceptUrl("https://peertube.mastodon.host/videos/watch/986aac60-1263-4f73-9ce5-36b18225cb60?fsdafs=fsafa"));
37+
assertTrue(linkHandler.acceptUrl("https://framatube.org/videos/embed/9c9de5e8-0a1e-484a-b099-e80766180a6d"));
3638
}
3739
}

0 commit comments

Comments
 (0)