11package org .schabi .newpipe .extractor .services .youtube ;
22
3+ import static org .junit .jupiter .api .Assertions .assertEquals ;
4+ import static org .junit .jupiter .api .Assertions .assertFalse ;
5+ import static org .junit .jupiter .api .Assertions .assertThrows ;
6+ import static org .junit .jupiter .api .Assertions .assertTrue ;
7+ import static org .schabi .newpipe .extractor .ExtractorAsserts .assertIsSecureUrl ;
8+ import static org .schabi .newpipe .extractor .ServiceList .YouTube ;
9+ import static org .schabi .newpipe .extractor .services .youtube .YoutubeParsingHelper .YOUTUBEI_V1_URL ;
10+ import static org .schabi .newpipe .extractor .services .youtube .YoutubeParsingHelper .getKey ;
11+ import static org .schabi .newpipe .extractor .services .youtube .YoutubeParsingHelper .prepareDesktopJsonBuilder ;
12+
313import com .grack .nanojson .JsonWriter ;
14+
415import org .junit .jupiter .api .BeforeAll ;
516import org .junit .jupiter .api .Test ;
617import org .schabi .newpipe .downloader .DownloaderFactory ;
1728
1829import java .io .IOException ;
1930import java .nio .charset .StandardCharsets ;
20- import java .util .*;
21-
22- import static org .junit .jupiter .api .Assertions .assertEquals ;
23- import static org .junit .jupiter .api .Assertions .assertFalse ;
24- import static org .junit .jupiter .api .Assertions .assertThrows ;
25- import static org .junit .jupiter .api .Assertions .assertTrue ;
26- import static org .schabi .newpipe .extractor .ExtractorAsserts .assertIsSecureUrl ;
27- import static org .schabi .newpipe .extractor .ServiceList .YouTube ;
28- import static org .schabi .newpipe .extractor .services .youtube .YoutubeParsingHelper .*;
31+ import java .util .HashMap ;
32+ import java .util .HashSet ;
33+ import java .util .Map ;
34+ import java .util .Random ;
35+ import java .util .Set ;
2936
3037public class YoutubeMixPlaylistExtractorTest {
3138
@@ -35,8 +42,8 @@ public class YoutubeMixPlaylistExtractorTest {
3542 private static YoutubeMixPlaylistExtractor extractor ;
3643
3744 public static class Mix {
38- private static final String VIDEO_ID = "UtF6Jej8yb4 " ;
39- private static final String VIDEO_TITLE = "Avicii - The Nights " ;
45+ private static final String VIDEO_ID = "QqsLTNkzvaY " ;
46+ private static final String VIDEO_TITLE = "Mix – " ;
4047
4148 @ BeforeAll
4249 public static void setUp () throws Exception {
@@ -128,10 +135,10 @@ void getPlaylistType() throws ParsingException {
128135
129136 public static class MixWithIndex {
130137
131- private static final String VIDEO_ID = "UtF6Jej8yb4 " ;
132- private static final String VIDEO_TITLE = "Avicii - The Nights " ;
133- private static final int INDEX = 4 ;
134- private static final String VIDEO_ID_NUMBER_4 = "ebXbLfLACGM " ;
138+ private static final String VIDEO_ID = "QqsLTNkzvaY " ;
139+ private static final String VIDEO_TITLE = "Mix – " ;
140+ private static final int INDEX = 7 ; // YT starts the index with 1...
141+ private static final String VIDEO_ID_AT_INDEX = "xAUJYP8tnRE " ;
135142
136143 @ BeforeAll
137144 public static void setUp () throws Exception {
@@ -140,7 +147,7 @@ public static void setUp() throws Exception {
140147 NewPipe .init (DownloaderFactory .getDownloader (RESOURCE_PATH + "mixWithIndex" ));
141148 dummyCookie .put (YoutubeMixPlaylistExtractor .COOKIE_NAME , "whatever" );
142149 extractor = (YoutubeMixPlaylistExtractor ) YouTube
143- .getPlaylistExtractor ("https://www.youtube.com/watch?v=" + VIDEO_ID_NUMBER_4
150+ .getPlaylistExtractor ("https://www.youtube.com/watch?v=" + VIDEO_ID_AT_INDEX
144151 + "&list=RD" + VIDEO_ID + "&index=" + INDEX );
145152 extractor .fetchPage ();
146153 }
0 commit comments