Skip to content

Commit 24fce9f

Browse files
committed
Fixed playlist returning only 100 videos
1 parent fd0f153 commit 24fce9f

1 file changed

Lines changed: 16 additions & 4 deletions

File tree

src/main/java/com/github/felipeucelli/javatube/Playlist.java

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,23 @@ protected JSONObject getJson() throws Exception {
7272
}
7373

7474
protected void setContinuationToken(JSONArray importantContent) throws JSONException {
75-
continuationToken = importantContent.getJSONObject(importantContent.length() - 1)
75+
JSONObject continuationEndpoint = importantContent.getJSONObject(importantContent.length() - 1)
7676
.getJSONObject("continuationItemRenderer")
77-
.getJSONObject("continuationEndpoint")
78-
.getJSONObject("continuationCommand")
79-
.getString("token");
77+
.getJSONObject("continuationEndpoint");
78+
79+
if (continuationEndpoint.has("continuationCommand")){
80+
continuationToken = continuationEndpoint
81+
.getJSONObject("continuationCommand")
82+
.getString("token");
83+
84+
}else if (continuationEndpoint.has("commandExecutorCommand")){
85+
continuationToken = continuationEndpoint
86+
.getJSONObject("commandExecutorCommand")
87+
.getJSONArray("commands")
88+
.getJSONObject(1)
89+
.getJSONObject("continuationCommand")
90+
.getString("token");
91+
}
8092
}
8193

8294
protected JSONArray extractContinuationItems(JSONArray importantContent) throws Exception {

0 commit comments

Comments
 (0)