fix(soundcloud): handle preview-only tracks with source fallback - #243
Open
AhmedMondo wants to merge 21 commits into
Open
AhmedMondo wants to merge 21 commits into
AhmedMondo wants to merge 21 commits into
Conversation
Signed-off-by: Ahmed <ahmedmondo288@gmail.com>
|
All Contributors have signed the CLA. The PR is now allowed to be merged. |
Author
|
I have read the CLA Document and I hereby sign the CLA |
performanc-bot
added a commit
to PerformanC/CLA-Signatures
that referenced
this pull request
Sep 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
api-v2.soundcloud.com/resolve, matching Lavaplayer's public web API flow instead of resolvingapi.soundcloud.com/tracks/{id}.full_duration,monetization_model,policy,access, andsnippetmetadata so preview-only tracks can be distinguished from normally playable uploads.SUB_HIGH_TIER,SNIP,/preview/transcoding URLs, and resolved 30-second/playlist/0/30/streams.full_durationover the 30-second previewduration.client_idhandling by using browser-style request headers, refreshing the web client ID after401responses, and reducing the cached client ID lifetime to avoid stale credentials.SOUNDCLOUD_PREVIEW_ONLYfailure cause so preview-only playback failures can be handled separately from normal SoundCloud errors.fallbackSourcesfor preview-only SoundCloud tracks. The fallback flow searches by ISRC first, then artist + title, uses the existinggetBestMatch()logic, and resolves the matched track through the fallback source.newTrack, allowing the existing player pipeline to fetch and play the replacement source without changing normal SoundCloud playback behavior.Why
SUB_HIGH_TIERwithpolicy: SNIP, expose only 30-second preview transcodings through the public SoundCloud web API.Track only has preview URL.full_duration. For example, a track may reportduration: 30000while its actualfull_durationis several minutes.Checkmarks
SUB_HIGH_TIER/SNIPtracks.getBestMatch()flow instead of introducing source-specific playback logic.Additional info
The fallback is intentionally limited to SoundCloud tracks that resolve as preview-only. It is not used for normally playable SoundCloud tracks.
An example preview-only response from SoundCloud looks like:
with only:
available as transcodings.
Previously, these tracks could not be played successfully by NodeLink. With this change, NodeLink reports
SOUNDCLOUD_PREVIEW_ONLY, searches the configured fallback sources, selects the closest match using existing matching logic, and continues playback through that source.The fallback source order can be configured through: