Skip to content
Open
Changes from all commits
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
12 changes: 9 additions & 3 deletions bridges/BandcampBridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ class BandcampBridge extends BridgeAbstract
'name' => 'limit',
'type' => 'number',
'title' => 'Number of releases to return',
'defaultValue' => 5
'defaultValue' => 5,
'exampleValue' => 5
]
],
'By album' => [
Expand Down Expand Up @@ -313,9 +314,14 @@ private function getImageUrl($id, $size)
private function apiGet($endpoint, $query_data)
{
$url = self::URI . 'api/' . $endpoint . '?' . http_build_query($query_data);
// 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',

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.

Where is Firefox version 124 coming from? Why not 140 (current esr) or sth. else?

];
$response = getContents($url, $header);
$data = json_decode($response);
if ($data === null) {
throwServerError('Bandcamp API returned an invalid response for: ' . $url);
}
return $data;
}

Expand Down
Loading