@@ -190,9 +190,10 @@ public InfoItemsPage<StreamInfoItem> getInitialPage() {
190190 return new InfoItemsPage <>(collector , null );
191191 } else if (contents .getObject (0 ).has ("playlistVideoListRenderer" )) {
192192 final JsonObject videos = contents .getObject (0 ).getObject ("playlistVideoListRenderer" );
193- collectStreamsFrom (collector , videos .getArray ("contents" ));
193+ final JsonArray videosArray = videos .getArray ("contents" );
194+ collectStreamsFrom (collector , videosArray );
194195
195- nextPage = getNextPageFrom (videos . getArray ( "continuations" ) );
196+ nextPage = getNextPageFrom (videosArray );
196197 }
197198
198199 return new InfoItemsPage <>(collector , nextPage );
@@ -207,24 +208,29 @@ public InfoItemsPage<StreamInfoItem> getPage(final Page page) throws IOException
207208 final StreamInfoItemsCollector collector = new StreamInfoItemsCollector (getServiceId ());
208209 final JsonArray ajaxJson = getJsonResponse (page .getUrl (), getExtractorLocalization ());
209210
210- final JsonObject sectionListContinuation = ajaxJson .getObject (1 ).getObject ("response" )
211- .getObject ("continuationContents" ).getObject ("playlistVideoListContinuation" );
211+ final JsonArray continuation = ajaxJson .getObject (1 )
212+ .getObject ("response" )
213+ .getArray ("onResponseReceivedActions" )
214+ .getObject (0 )
215+ .getObject ("appendContinuationItemsAction" )
216+ .getArray ("continuationItems" );
212217
213- collectStreamsFrom (collector , sectionListContinuation . getArray ( "contents" ) );
218+ collectStreamsFrom (collector , continuation );
214219
215- return new InfoItemsPage <>(collector , getNextPageFrom (sectionListContinuation . getArray ( "continuations" ) ));
220+ return new InfoItemsPage <>(collector , getNextPageFrom (continuation ));
216221 }
217222
218- private Page getNextPageFrom (final JsonArray continuations ) {
219- if (isNullOrEmpty (continuations )) {
223+ private Page getNextPageFrom (final JsonArray contents ) {
224+ if (isNullOrEmpty (contents )) {
220225 return null ;
221226 }
222227
223- final JsonObject nextContinuationData = continuations .getObject (0 ).getObject ("nextContinuationData" );
224- final String continuation = nextContinuationData .getString ("continuation" );
225- final String clickTrackingParams = nextContinuationData .getString ("clickTrackingParams" );
226- return new Page ("https://www.youtube.com/browse_ajax?ctoken=" + continuation + "&continuation=" + continuation
227- + "&itct=" + clickTrackingParams );
228+ final String continuation = contents .getObject (contents .size () - 1 )
229+ .getObject ("continuationItemRenderer" )
230+ .getObject ("continuationEndpoint" )
231+ .getObject ("continuationCommand" )
232+ .getString ("token" );
233+ return new Page ("https://www.youtube.com/browse_ajax?continuation=" + continuation );
228234 }
229235
230236 private void collectStreamsFrom (final StreamInfoItemsCollector collector , final JsonArray videos ) {
0 commit comments