Skip to content

[SoundCloud] Miscellaneous refactors#1323

Merged
Stypox merged 13 commits intoTeamNewPipe:devfrom
absurdlylongusername:minor-code-cleanup
Oct 2, 2025
Merged

[SoundCloud] Miscellaneous refactors#1323
Stypox merged 13 commits intoTeamNewPipe:devfrom
absurdlylongusername:minor-code-cleanup

Conversation

@absurdlylongusername
Copy link
Copy Markdown
Member

  • 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.

Some minor refactorings

  • Add toString to DateWrapper for better debugging
  • make SoundcloudStreamExtractor.getTimeStamp return 0 if not timestamp found in the url
  • Use Pattern instead of String in regex for SoundcloudStreamLinkHandlerFactory
  • Refactor Parser.java
  • Refactor AudioStream constructor to take builder instead of many parameters
  • Other minor changes

@TobiGr TobiGr added SoundCloud Service, https://soundcloud.com/ code quality Improvements to the codebase to improve the code quality labels Jul 8, 2025
@ShareASmile ShareASmile changed the title Miscellaneous refactors [SoundCloud] Miscellaneous refactors Jul 8, 2025
Copy link
Copy Markdown
Member

@Stypox Stypox left a comment

Choose a reason for hiding this comment

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

Looks good to me, thank you!

public long getTimeStamp() throws ParsingException {
return getTimestampSeconds("(#t=\\d{0,3}h?\\d{0,3}m?\\d{1,3}s?)");
final var timestamp = getTimestampSeconds("(#t=\\d{0,3}h?\\d{0,3}m?\\d{1,3}s?)");
return timestamp == -2 ? 0 : timestamp;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

For a future PR, you could make getTimestampSeconds() return an Optional<>. Also, all regex-related functions should ideally only take Patterns, so we can avoid rebuilding regexes every time.

@Stypox Stypox force-pushed the minor-code-cleanup branch from d600f8d to 25113b2 Compare October 2, 2025 12:50
@Stypox Stypox merged commit 52bcf56 into TeamNewPipe:dev Oct 2, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

code quality Improvements to the codebase to improve the code quality SoundCloud Service, https://soundcloud.com/

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants