simplify youtube channels url detection

This commit is contained in:
Athou
2025-01-23 21:49:52 +01:00
parent dae5efa787
commit fde8dab8cd
2 changed files with 30 additions and 5 deletions

View File

@@ -0,0 +1,22 @@
package com.commafeed.backend.urlprovider;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
class YoutubeFeedURLProviderTest {
private final YoutubeFeedURLProvider provider = new YoutubeFeedURLProvider();
@Test
void matchesYoutubeChannelURL() {
Assertions.assertEquals("https://www.youtube.com/feeds/videos.xml?channel_id=abc",
provider.get("https://www.youtube.com/channel/abc", null));
}
@Test
void doesNotmatchYoutubeChannelURL() {
Assertions.assertNull(provider.get("https://www.anothersite.com/channel/abc", null));
Assertions.assertNull(provider.get("https://www.youtube.com/user/abc", null));
}
}