@@ -85,6 +85,7 @@ public void onFetchPage(@Nonnull Downloader downloader) throws IOException, Extr
8585
8686 @ Override
8787 public String getNextPageUrl () throws ExtractionException {
88+ if (getVideoTab () == null ) return "" ;
8889 return getNextPageUrlFrom (getVideoTab ().getObject ("content" ).getObject ("sectionListRenderer" )
8990 .getArray ("contents" ).getObject (0 ).getObject ("itemSectionRenderer" )
9091 .getArray ("contents" ).getObject (0 ).getObject ("gridRenderer" ).getArray ("continuations" ));
@@ -195,10 +196,12 @@ public String getDescription() throws ParsingException {
195196 public InfoItemsPage <StreamInfoItem > getInitialPage () throws ExtractionException {
196197 StreamInfoItemsCollector collector = new StreamInfoItemsCollector (getServiceId ());
197198
198- JsonArray videos = getVideoTab ().getObject ("content" ).getObject ("sectionListRenderer" ).getArray ("contents" )
199- .getObject (0 ).getObject ("itemSectionRenderer" ).getArray ("contents" ).getObject (0 )
200- .getObject ("gridRenderer" ).getArray ("items" );
201- collectStreamsFrom (collector , videos );
199+ if (getVideoTab () != null ) {
200+ JsonArray videos = getVideoTab ().getObject ("content" ).getObject ("sectionListRenderer" ).getArray ("contents" )
201+ .getObject (0 ).getObject ("itemSectionRenderer" ).getArray ("contents" ).getObject (0 )
202+ .getObject ("gridRenderer" ).getArray ("items" );
203+ collectStreamsFrom (collector , videos );
204+ }
202205
203206 return new InfoItemsPage <>(collector , getNextPageUrl ());
204207 }
@@ -241,9 +244,7 @@ public InfoItemsPage<StreamInfoItem> getPage(String pageUrl) throws IOException,
241244
242245
243246 private String getNextPageUrlFrom (JsonArray continuations ) {
244- if (continuations == null ) {
245- return "" ;
246- }
247+ if (continuations == null ) return "" ;
247248
248249 JsonObject nextContinuationData = continuations .getObject (0 ).getObject ("nextContinuationData" );
249250 String continuation = nextContinuationData .getString ("continuation" );
@@ -295,6 +296,14 @@ private JsonObject getVideoTab() throws ParsingException {
295296 throw new ParsingException ("Could not find Videos tab" );
296297 }
297298
299+ try {
300+ if (videoTab .getObject ("content" ).getObject ("sectionListRenderer" ).getArray ("contents" )
301+ .getObject (0 ).getObject ("itemSectionRenderer" ).getArray ("contents" )
302+ .getObject (0 ).getObject ("messageRenderer" ).getObject ("text" ).getArray ("runs" )
303+ .getObject (0 ).getString ("text" ).equals ("This channel has no videos." ))
304+ return null ;
305+ } catch (Exception ignored ) {}
306+
298307 return videoTab ;
299308 }
300309}
0 commit comments