Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,7 @@ public InfoItemsPage<StreamInfoItem> getInitialPage() {
streamInfoItemsCollector.commit(
new SoundcloudStreamInfoItemExtractor(track));
} else {
// %09d would be enough, but a 0 before the number does not create
// problems, so let's be sure
ids.add(String.format("%010d", track.getInt("id")));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change causes the mocks to be invalid. Please add a test for a very small ID and also for one that is exceeding the 32 bit of an int. You can fix the tests by recording the mocks for all SoundCloud tests again (see our docs for more info).

Copy link
Copy Markdown
Contributor Author

@G-flat G-flat Jan 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated the SoundcloudPlaylistExtractor mocks and also added two SoundcloudStreamExtractor tests, one for a small track ID (135535700) and one for a track ID that's larger than 32 bits of an int (2167944333).

ids.add(String.valueOf(track.getLong("id")));
}
});

Expand Down Expand Up @@ -187,15 +185,15 @@ public InfoItemsPage<StreamInfoItem> getPage(final Page page) throws IOException
final JsonArray tracks = JsonParser.array().from(response);
// Response may not contain tracks in the same order as currentIds.
// The streams are displayed in the order which is used in currentIds on SoundCloud.
final HashMap<Integer, JsonObject> idToTrack = new HashMap<>();
final HashMap<Long, JsonObject> idToTrack = new HashMap<>();
for (final Object track : tracks) {
if (track instanceof JsonObject) {
final JsonObject o = (JsonObject) track;
idToTrack.put(o.getInt("id"), o);
idToTrack.put(o.getLong("id"), o);
}
}
for (final String strId : currentIds) {
final int id = Integer.parseInt(strId);
final long id = Long.parseLong(strId);
try {
collector.commit(new SoundcloudStreamInfoItemExtractor(
Objects.requireNonNull(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public void onFetchPage(@Nonnull final Downloader downloader) throws IOException
@Nonnull
@Override
public String getId() {
return String.valueOf(track.getInt("id"));
return String.valueOf(track.getLong("id"));
}

@Nonnull
Expand Down
Loading