|
11 | 11 | import org.schabi.newpipe.extractor.exceptions.ParsingException; |
12 | 12 | import org.schabi.newpipe.extractor.services.youtube.linkHandler.YoutubeStreamLinkHandlerFactory; |
13 | 13 |
|
14 | | -import java.util.ArrayList; |
15 | | -import java.util.List; |
16 | | - |
17 | | -import static org.junit.jupiter.api.Assertions.*; |
| 14 | +import static org.junit.jupiter.api.Assertions.assertEquals; |
| 15 | +import static org.junit.jupiter.api.Assertions.assertThrows; |
| 16 | +import static org.junit.jupiter.api.Assertions.assertTrue; |
18 | 17 |
|
19 | 18 | /** |
20 | 19 | * Test for {@link YoutubeStreamLinkHandlerFactory} |
21 | 20 | */ |
| 21 | +@SuppressWarnings("HttpUrlsUsage") |
22 | 22 | public class YoutubeStreamLinkHandlerFactoryTest { |
23 | 23 | private static YoutubeStreamLinkHandlerFactory linkHandler; |
24 | 24 |
|
@@ -53,25 +53,25 @@ void getIdForInvalidUrls(final String invalidUrl) { |
53 | 53 |
|
54 | 54 | @ParameterizedTest |
55 | 55 | @ValueSource(strings = { |
56 | | - "https://www.youtube.com/watch?v=jZViOEv90dI", |
57 | | - "https://www.youtube.com/watch?v=jZViOEv90dI&t=100", |
58 | | - "https://WWW.YouTube.com/watch?v=jZViOEv90dI&t=100", |
59 | | - "HTTPS://www.youtube.com/watch?v=jZViOEv90dI&t=100", |
60 | | - "https://youtu.be/jZViOEv90dI?t=9s", |
61 | | - "HTTPS://Youtu.be/jZViOEv90dI?t=9s", |
62 | | - "https://www.youtube.com/embed/jZViOEv90dI", |
63 | | - "https://www.youtube-nocookie.com/embed/jZViOEv90dI", |
64 | | - "http://www.youtube.com/watch?v=jZViOEv90dI", |
65 | | - "http://youtube.com/watch?v=jZViOEv90dI", |
66 | | - "http://youtu.be/jZViOEv90dI?t=9s", |
67 | | - "http://www.youtube.com/embed/jZViOEv90dI", |
68 | | - "http://www.Youtube.com/embed/jZViOEv90dI", |
69 | | - "http://www.youtube-nocookie.com/embed/jZViOEv90dI", |
70 | | - "vnd.youtube://www.youtube.com/watch?v=jZViOEv90dI", |
71 | | - "vnd.youtube:jZViOEv90dI" |
| 56 | + "https://www.youtube.com/watch?v=9Dpqou5cI08", |
| 57 | + "https://www.youtube.com/watch?v=9Dpqou5cI08&t=100", |
| 58 | + "https://WWW.YouTube.com/watch?v=9Dpqou5cI08&t=100", |
| 59 | + "HTTPS://www.youtube.com/watch?v=9Dpqou5cI08&t=100", |
| 60 | + "https://youtu.be/9Dpqou5cI08?t=9s", |
| 61 | + "HTTPS://Youtu.be/9Dpqou5cI08?t=9s", |
| 62 | + "https://www.youtube.com/embed/9Dpqou5cI08", |
| 63 | + "https://www.youtube-nocookie.com/embed/9Dpqou5cI08", |
| 64 | + "http://www.youtube.com/watch?v=9Dpqou5cI08", |
| 65 | + "http://youtube.com/watch?v=9Dpqou5cI08", |
| 66 | + "http://youtu.be/9Dpqou5cI08?t=9s", |
| 67 | + "http://www.youtube.com/embed/9Dpqou5cI08", |
| 68 | + "http://www.Youtube.com/embed/9Dpqou5cI08", |
| 69 | + "http://www.youtube-nocookie.com/embed/9Dpqou5cI08", |
| 70 | + "vnd.youtube://www.youtube.com/watch?v=9Dpqou5cI08", |
| 71 | + "vnd.youtube:9Dpqou5cI08" |
72 | 72 | }) |
73 | | - void getId_jZViOEv90dI_fromYt(final String url) throws Exception { |
74 | | - assertEquals("jZViOEv90dI", linkHandler.fromUrl(url).getId()); |
| 73 | + void getId_9Dpqou5cI08_fromYt(final String url) throws Exception { |
| 74 | + assertEquals("9Dpqou5cI08", linkHandler.fromUrl(url).getId()); |
75 | 75 | } |
76 | 76 |
|
77 | 77 | @ParameterizedTest |
@@ -117,27 +117,28 @@ void getId_diverse_fromYt(final String expectedId, final String url) throws Exce |
117 | 117 |
|
118 | 118 | @ParameterizedTest |
119 | 119 | @ValueSource(strings = { |
120 | | - "https://www.youtube.com/watch?v=jZViOEv90dI", |
121 | | - "https://www.youtube.com/watch?v=jZViOEv90dI&t=100", |
122 | | - "https://WWW.YouTube.com/watch?v=jZViOEv90dI&t=100", |
123 | | - "HTTPS://www.youtube.com/watch?v=jZViOEv90dI&t=100", |
124 | | - "https://youtu.be/jZViOEv90dI?t=9s", |
125 | | - "https://www.youtube.com/embed/jZViOEv90dI", |
126 | | - "https://www.youtube-nocookie.com/embed/jZViOEv90dI", |
127 | | - "http://www.youtube.com/watch?v=jZViOEv90dI", |
128 | | - "http://youtu.be/jZViOEv90dI?t=9s", |
129 | | - "http://www.youtube.com/embed/jZViOEv90dI", |
130 | | - "http://www.youtube-nocookie.com/embed/jZViOEv90dI", |
| 120 | + "https://www.youtube.com/watch?v=9Dpqou5cI08", |
| 121 | + "https://www.youtube.com/watch?v=9Dpqou5cI08&t=100", |
| 122 | + "https://WWW.YouTube.com/watch?v=9Dpqou5cI08&t=100", |
| 123 | + "HTTPS://www.youtube.com/watch?v=9Dpqou5cI08&t=100", |
| 124 | + "https://youtu.be/9Dpqou5cI08?t=9s", |
| 125 | + "https://www.youtube.com/embed/9Dpqou5cI08", |
| 126 | + "https://www.youtube-nocookie.com/embed/9Dpqou5cI08", |
| 127 | + "http://www.youtube.com/watch?v=9Dpqou5cI08", |
| 128 | + "http://youtu.be/9Dpqou5cI08?t=9s", |
| 129 | + "http://www.youtube.com/embed/9Dpqou5cI08", |
| 130 | + "http://www.youtube-nocookie.com/embed/9Dpqou5cI08", |
131 | 131 | "http://www.youtube.com/attribution_link?a=JdfC0C9V6ZI&u=%2Fwatch%3Fv%3DEhxJLojIE_o%26feature%3Dshare", |
132 | | - "vnd.youtube://www.youtube.com/watch?v=jZViOEv90dI", |
133 | | - "vnd.youtube:jZViOEv90dI", |
134 | | - "vnd.youtube.launch:jZViOEv90dI", |
| 132 | + "vnd.youtube://www.youtube.com/watch?v=9Dpqou5cI08", |
| 133 | + "vnd.youtube:9Dpqou5cI08", |
| 134 | + "vnd.youtube.launch:9Dpqou5cI08", |
135 | 135 | "https://music.youtube.com/watch?v=O0EDx9WAelc", |
136 | 136 | "https://www.youtube.com/shorts/IOS2fqxwYbA", |
137 | 137 | "http://www.youtube.com/shorts/IOS2fqxwYbA", |
138 | 138 | "http://www.youtube.com/v/IOS2fqxwYbA", |
139 | 139 | "https://www.youtube.com/w/IOS2fqxwYbA", |
140 | | - "https://www.youtube.com/watch/IOS2fqxwYbA" |
| 140 | + "https://www.youtube.com/watch/IOS2fqxwYbA", |
| 141 | + "https://www.youtube.com/live/rUxyKA_-grg" |
141 | 142 | }) |
142 | 143 | void acceptYtUrl(final String url) throws ParsingException { |
143 | 144 | assertTrue(linkHandler.acceptUrl(url)); |
|
0 commit comments