File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3030import org .schabi .newpipe .extractor .utils .Utils ;
3131
3232import java .io .IOException ;
33+ import java .util .List ;
34+ import java .util .stream .Collectors ;
3335
3436/**
3537 * Test for {@link YoutubePlaylistExtractor}
@@ -576,4 +578,34 @@ void testOnlySingleContinuation() throws Exception {
576578 assertFalse (page .hasNextPage (), "More items available when it shouldn't" );
577579 }
578580 }
581+
582+ public static class MembersOnlyTests {
583+
584+ @ BeforeAll
585+ public static void setUp () {
586+ YoutubeTestsUtils .ensureStateless ();
587+ NewPipe .init (DownloaderFactory .getDownloader (RESOURCE_PATH + "membersOnlyVideos" ));
588+ }
589+
590+ @ Test
591+ void testOnlyMembersOnlyVideos () throws Exception {
592+ final YoutubePlaylistExtractor extractor = (YoutubePlaylistExtractor ) YouTube
593+ .getPlaylistExtractor (
594+ // auto-generated playlist with only membersOnly videos
595+ "https://www.youtube.com/playlist?list=UUMOQuLXlFNAeDJMSmuzHU5axw" );
596+ extractor .fetchPage ();
597+
598+ final List <StreamInfoItem > allItems = extractor .getInitialPage ().getItems ()
599+ .stream ()
600+ .filter (StreamInfoItem .class ::isInstance )
601+ .map (StreamInfoItem .class ::cast )
602+ .collect (Collectors .toUnmodifiableList ());
603+ final List <StreamInfoItem > membershipVideos = allItems .stream ()
604+ .filter (item -> !item .requiresMembership ())
605+ .collect (Collectors .toUnmodifiableList ());
606+
607+ assertFalse (allItems .isEmpty ());
608+ assertTrue (membershipVideos .isEmpty ());
609+ }
610+ }
579611}
You can’t perform that action at this time.
0 commit comments