@@ -101,7 +101,7 @@ private String findInitialCommentsToken() throws ExtractionException {
101101
102102 if (itemSectionRenderer .isPresent ()) {
103103 token = JsonUtils .getString (((JsonObject ) itemSectionRenderer .get ())
104- .getObject ("itemSectionRenderer" ).getArray ("contents" ).getObject (0 ),
104+ .getObject ("itemSectionRenderer" ).getArray ("contents" ).getObject (0 ),
105105 "continuationItemRenderer.continuationEndpoint.continuationCommand.token" );
106106 } else {
107107 token = null ;
@@ -140,10 +140,13 @@ private Page getNextPage(@Nonnull final JsonObject ajaxJson) throws ExtractionEx
140140 return null ;
141141 }
142142
143+ final JsonObject continuationItemRenderer = jsonArray .getObject (jsonArray .size () - 1 ).getObject ("continuationItemRenderer" );
144+
145+ final String jsonPath = continuationItemRenderer .has ("button" ) ? "button.buttonRenderer.command.continuationCommand.token" : "continuationEndpoint.continuationCommand.token" ;
146+
143147 final String continuation ;
144148 try {
145- continuation = JsonUtils .getString (jsonArray .getObject (jsonArray .size () - 1 ),
146- "continuationItemRenderer.continuationEndpoint.continuationCommand.token" );
149+ continuation = JsonUtils .getString (continuationItemRenderer , jsonPath );
147150 } catch (final Exception e ) {
148151 return null ;
149152 }
@@ -167,7 +170,7 @@ public InfoItemsPage<CommentsInfoItem> getPage(final Page page)
167170
168171 final Localization localization = getExtractorLocalization ();
169172 final byte [] body = JsonWriter .string (prepareDesktopJsonBuilder (localization ,
170- getExtractorContentCountry ())
173+ getExtractorContentCountry ())
171174 .value ("continuation" , page .getId ())
172175 .done ())
173176 .getBytes (UTF_8 );
@@ -236,7 +239,7 @@ public void onFetchPage(@Nonnull final Downloader downloader)
236239 throws IOException , ExtractionException {
237240 final Localization localization = getExtractorLocalization ();
238241 final byte [] body = JsonWriter .string (prepareDesktopJsonBuilder (localization ,
239- getExtractorContentCountry ())
242+ getExtractorContentCountry ())
240243 .value ("videoId" , getId ())
241244 .done ())
242245 .getBytes (UTF_8 );
0 commit comments