[BandcampBridge] Fix JS challenge by setting User-Agent in apiGet()#4979
Open
sid115 wants to merge 2 commits into
Open
[BandcampBridge] Fix JS challenge by setting User-Agent in apiGet()#4979sid115 wants to merge 2 commits into
sid115 wants to merge 2 commits into
Conversation
Pull request artifacts
last change: Tuesday 2026-05-05 22:39:41 |
Author
|
Ok, I need some help fixing the gh actions. Not sure what is going wrong here. I am very confident that the fix works since I run my fork on my RSS-Bridge instance successfully. |
Mynacol
reviewed
May 23, 2026
| // todo: 429 Too Many Requests happens a lot | ||
| $response = getContents($url); | ||
| $header = [ | ||
| 'User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:124.0) Gecko/20100101 Firefox/124.0', |
Contributor
There was a problem hiding this comment.
Where is Firefox version 124 coming from? Why not 140 (current esr) or sth. else?
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.
Bandcamp's mobile API returns a JavaScript challenge page when requests are made without a User-Agent header, causing json_decode() to return null and a subsequent count(null) TypeError.
Explicitly set a browser User-Agent in apiGet() to bypass this. Also add null check on the response to give a meaningful error instead of a TypeError if the API returns an unexpected response in the future.
Resolves #4978.