File tree Expand file tree Collapse file tree
extractor/src/main/java/org/schabi/newpipe/extractor
services/youtube/extractors Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33import org .schabi .newpipe .extractor .exceptions .ExtractionException ;
44import org .schabi .newpipe .extractor .linkhandler .ListLinkHandler ;
55
6- import javax .annotation .Nonnull ;
76import java .io .IOException ;
87import java .util .Collections ;
98import java .util .List ;
109
10+ import javax .annotation .Nonnull ;
11+
1112/**
1213 * Base class to extractors that have a list (e.g. playlists, users).
1314 */
1415public abstract class ListExtractor <R extends InfoItem > extends Extractor {
1516
17+ /**
18+ * Constant that should be returned whenever
19+ * a list has an unknown number of items.
20+ */
21+ public static final long ITEM_COUNT_UNKNOWN = -1 ;
22+ /**
23+ * Constant that should be returned whenever a list has an
24+ * infinite number of items. For example a YouTube mix.
25+ */
26+ public static final long ITEM_COUNT_INFINITE = -2 ;
27+ /**
28+ * Constant that should be returned whenever a list
29+ * has an unknown number of items bigger than 100.
30+ */
31+ public static final long ITEM_COUNT_MORE_THAN_100 = -3 ;
32+
1633 public ListExtractor (StreamingService service , ListLinkHandler linkHandler ) {
1734 super (service , linkHandler );
1835 }
Original file line number Diff line number Diff line change 77import org .schabi .newpipe .extractor .stream .StreamInfoItem ;
88
99public abstract class PlaylistExtractor extends ListExtractor <StreamInfoItem > {
10- public final static long UNKNOWN_ITEMS = -1 ;
11- public final static long INFINITE_ITEMS = -2 ;
12- public final static long MORE_THAN_100_ITEMS = -3 ;
1310
1411 public PlaylistExtractor (StreamingService service , ListLinkHandler linkHandler ) {
1512 super (service , linkHandler );
Original file line number Diff line number Diff line change 3030
3131import javax .annotation .Nonnull ;
3232
33- import static org .schabi .newpipe .extractor .playlist .PlaylistExtractor .MORE_THAN_100_ITEMS ;
34- import static org .schabi .newpipe .extractor .playlist .PlaylistExtractor .UNKNOWN_ITEMS ;
3533import static org .schabi .newpipe .extractor .services .youtube .linkHandler .YoutubeParsingHelper .fixThumbnailUrl ;
3634import static org .schabi .newpipe .extractor .services .youtube .linkHandler .YoutubeParsingHelper .getJsonResponse ;
3735import static org .schabi .newpipe .extractor .services .youtube .linkHandler .YoutubeParsingHelper .getTextFromObject ;
@@ -531,12 +529,12 @@ public String getUploaderName() throws ParsingException {
531529
532530 @ Override
533531 public long getStreamCount () throws ParsingException {
534- if (searchType .equals (MUSIC_ALBUMS )) return UNKNOWN_ITEMS ;
532+ if (searchType .equals (MUSIC_ALBUMS )) return ITEM_COUNT_UNKNOWN ;
535533 String count = getTextFromObject (info .getArray ("flexColumns" ).getObject (2 )
536534 .getObject ("musicResponsiveListItemFlexColumnRenderer" ).getObject ("text" ));
537535 if (count != null && !count .isEmpty ()) {
538536 if (count .contains ("100+" )) {
539- return MORE_THAN_100_ITEMS ;
537+ return ITEM_COUNT_MORE_THAN_100 ;
540538 } else {
541539 return Long .parseLong (Utils .removeNonDigitCharacters (count ));
542540 }
You can’t perform that action at this time.
0 commit comments