44import static org .junit .jupiter .api .Assertions .assertNotEquals ;
55import static org .junit .jupiter .api .Assertions .assertSame ;
66import static org .schabi .newpipe .extractor .ExtractorAsserts .assertContains ;
7+ import static org .schabi .newpipe .extractor .ExtractorAsserts .assertGreaterOrEqual ;
78import static org .schabi .newpipe .extractor .ServiceList .YouTube ;
89import static org .schabi .newpipe .extractor .services .youtube .stream .YoutubeStreamExtractorDefaultTest .YOUTUBE_LICENCE ;
910
1011import org .junit .jupiter .api .BeforeAll ;
11- import org .junit .jupiter .api .Disabled ;
1212import org .junit .jupiter .api .Test ;
1313import org .schabi .newpipe .downloader .DownloaderFactory ;
1414import org .schabi .newpipe .extractor .InfoItem ;
1717import org .schabi .newpipe .extractor .playlist .PlaylistInfo .PlaylistType ;
1818import org .schabi .newpipe .extractor .playlist .PlaylistInfoItem ;
1919import org .schabi .newpipe .extractor .services .DefaultStreamExtractorTest ;
20+ import org .schabi .newpipe .extractor .services .youtube .YoutubeParsingHelper ;
2021import org .schabi .newpipe .extractor .services .youtube .YoutubeTestsUtils ;
2122import org .schabi .newpipe .extractor .stream .StreamExtractor ;
2223import org .schabi .newpipe .extractor .stream .StreamType ;
@@ -38,6 +39,7 @@ public class YoutubeStreamExtractorRelatedMixTest extends DefaultStreamExtractor
3839 @ BeforeAll
3940 public static void setUp () throws Exception {
4041 YoutubeTestsUtils .ensureStateless ();
42+ YoutubeParsingHelper .setConsentAccepted (true );
4143 NewPipe .init (DownloaderFactory .getDownloader (RESOURCE_PATH + "relatedMix" ));
4244 extractor = YouTube .getStreamExtractor (URL );
4345 extractor .fetchPage ();
@@ -80,7 +82,6 @@ public static void setUp() throws Exception {
8082 // @formatter:on
8183
8284 @ Test
83- @ Disabled ("Mixes are not available in related items anymore, see https://github.com/TeamNewPipe/NewPipeExtractor/issues/820" )
8485 @ Override
8586 public void testRelatedItems () throws Exception {
8687 super .testRelatedItems ();
@@ -97,7 +98,7 @@ public void testRelatedItems() throws Exception {
9798 final List <PlaylistInfoItem > streamMixes = playlists .stream ()
9899 .filter (item -> item .getPlaylistType ().equals (PlaylistType .MIX_STREAM ))
99100 .collect (Collectors .toList ());
100- assertEquals (1 , streamMixes .size (), "Not found exactly one stream mix in related items" );
101+ assertGreaterOrEqual (1 , streamMixes .size (), "Not found one or more stream mix in related items" );
101102
102103 final PlaylistInfoItem streamMix = streamMixes .get (0 );
103104 assertSame (InfoItem .InfoType .PLAYLIST , streamMix .getInfoType ());
@@ -106,17 +107,5 @@ public void testRelatedItems() throws Exception {
106107 assertContains ("list=RD" + ID , streamMix .getUrl ());
107108 assertEquals ("Mix – " + TITLE , streamMix .getName ());
108109 YoutubeTestsUtils .testImages (streamMix .getThumbnails ());
109-
110- final List <PlaylistInfoItem > musicMixes = playlists .stream ()
111- .filter (item -> item .getPlaylistType ().equals (PlaylistType .MIX_MUSIC ))
112- .collect (Collectors .toList ());
113- assertEquals (1 , musicMixes .size (), "Not found exactly one music mix in related items" );
114-
115- final PlaylistInfoItem musicMix = musicMixes .get (0 );
116- assertSame (InfoItem .InfoType .PLAYLIST , musicMix .getInfoType ());
117- assertEquals (YouTube .getServiceId (), musicMix .getServiceId ());
118- assertContains ("list=RDCLAK" , musicMix .getUrl ());
119- assertEquals ("Hip Hop Essentials" , musicMix .getName ());
120- YoutubeTestsUtils .testImages (musicMix .getThumbnails ());
121110 }
122111}
0 commit comments