Skip to content

Commit 5d3eaca

Browse files
committed
Use 64-bit SoundCloud track IDs
1 parent 251f7f6 commit 5d3eaca

2 files changed

Lines changed: 5 additions & 7 deletions

File tree

extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/extractors/SoundcloudPlaylistExtractor.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,7 @@ public InfoItemsPage<StreamInfoItem> getInitialPage() {
149149
streamInfoItemsCollector.commit(
150150
new SoundcloudStreamInfoItemExtractor(track));
151151
} else {
152-
// %09d would be enough, but a 0 before the number does not create
153-
// problems, so let's be sure
154-
ids.add(String.format("%010d", track.getInt("id")));
152+
ids.add(String.valueOf(track.getLong("id")));
155153
}
156154
});
157155

@@ -187,15 +185,15 @@ public InfoItemsPage<StreamInfoItem> getPage(final Page page) throws IOException
187185
final JsonArray tracks = JsonParser.array().from(response);
188186
// Response may not contain tracks in the same order as currentIds.
189187
// The streams are displayed in the order which is used in currentIds on SoundCloud.
190-
final HashMap<Integer, JsonObject> idToTrack = new HashMap<>();
188+
final HashMap<Long, JsonObject> idToTrack = new HashMap<>();
191189
for (final Object track : tracks) {
192190
if (track instanceof JsonObject) {
193191
final JsonObject o = (JsonObject) track;
194-
idToTrack.put(o.getInt("id"), o);
192+
idToTrack.put(o.getLong("id"), o);
195193
}
196194
}
197195
for (final String strId : currentIds) {
198-
final int id = Integer.parseInt(strId);
196+
final long id = Long.parseLong(strId);
199197
try {
200198
collector.commit(new SoundcloudStreamInfoItemExtractor(
201199
Objects.requireNonNull(

extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/extractors/SoundcloudStreamExtractor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public void onFetchPage(@Nonnull final Downloader downloader) throws IOException
7979
@Nonnull
8080
@Override
8181
public String getId() {
82-
return String.valueOf(track.getInt("id"));
82+
return String.valueOf(track.getLong("id"));
8383
}
8484

8585
@Nonnull

0 commit comments

Comments
 (0)