Skip to content

Fix Soundcloud comments crash by handling null page URLs#1476

Open
Ecomont wants to merge 4 commits intoTeamNewPipe:devfrom
Ecomont:fix/soundcloud-comments-no-url
Open

Fix Soundcloud comments crash by handling null page URLs#1476
Ecomont wants to merge 4 commits intoTeamNewPipe:devfrom
Ecomont:fix/soundcloud-comments-no-url

Conversation

@Ecomont
Copy link
Copy Markdown

@Ecomont Ecomont commented Apr 13, 2026

Description

This PR fixes the IllegalArgumentException: Page doesn't contain an URL crash when trying to extract comments from SoundCloud tracks that have no comments or have them disabled (e.g., https://soundcloud.com/user-722618400/a-real-playa).

Previously, SoundcloudCommentsExtractor threw an exception if page.getUrl() or next_href was null or empty. This changes the behavior to gracefully return an empty InfoItemsPage or set a null next page, aligning with how the extractor should handle empty datasets without crashing the client app.

Resolves #1243
Helps resolve TeamNewPipe/NewPipe#11728

  • I carefully read the contribution guidelines and agree to them.
  • I have tested the API against NewPipe.
  • I agree to create a pull request for NewPipe as soon as possible to make it compatible with the changed API.

@ShareASmile ShareASmile added bug Issue is related to a bug soundcloud service, https://soundcloud.com/ labels Apr 13, 2026
@TobiGr
Copy link
Copy Markdown
Contributor

TobiGr commented Apr 13, 2026

Thank you. Please add a test for the URL mentioned above to ensure that we do not introduce a regression at a later point in time.

Ecomont added 2 commits April 14, 2026 05:55
- Created generated_mock_2.json and generated_mock_3.json to simulate responses for tracks without comments.
- Added generated_mock_4.json to represent a response for fetching comments on a track that has none.
- Each mock includes request details, response headers, and body structure to facilitate testing.
@sonarqubecloud
Copy link
Copy Markdown

@Ecomont
Copy link
Copy Markdown
Author

Ecomont commented Apr 14, 2026

@TobiGr Thankss I've just pushed the requested tests.

While writing the test for https://soundcloud.com/user-722618400/a-real-playa does have comments on the official website, but still crashes. The problem is that the current SoundcloudCommentsExtractor fails to find the URL/next_href in the json response for this specific track (likely due to an internal API change by SoundCloud for certain tracks).

Because the extactor couldn't find the next_href, it was triggering the IllegalArgumentException at line 44, crashing the entire app

My changes solve two scenarios at once the tracks with genuinely no comments, instead of crashing with IllegalArgumentException("Page doesn't contain an URL"), it now correctly and gracefully returns InfoItemsPage.emptyPage() and tracks like "a-real-playa" where SoundCloud's json fails to provide a valid next_href string, the new isNullOrEmpty(nextHref) ? null : new Page(nextHref) check prevents passing a null string into the Page constructor, which also prevents subsequent crashes when trying to load more items.

Let me know if anything else is needed.

@TobiGr
Copy link
Copy Markdown
Contributor

TobiGr commented Apr 17, 2026

Thank you. Some of the new tests are failing.

@sonarqubecloud
Copy link
Copy Markdown

@Ecomont
Copy link
Copy Markdown
Author

Ecomont commented Apr 17, 2026

Thank you. Some of the new tests are failing.

@TobiGr Done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Issue is related to a bug soundcloud service, https://soundcloud.com/

Projects

None yet

3 participants