Skip to content

Bandcamp wishlist from api#148

Draft
snus-kin wants to merge 4 commits intofiso64:masterfrom
snus-kin:bandcamp-wishlist-from-api
Draft

Bandcamp wishlist from api#148
snus-kin wants to merge 4 commits intofiso64:masterfrom
snus-kin:bandcamp-wishlist-from-api

Conversation

@snus-kin
Copy link
Copy Markdown

This works for me at least, not really 100% sure about the initial token generation, would be nice to have track list length etc.

{
// Generate a token with current timestamp for the initial request
long currentTimestamp = DateTimeOffset.UtcNow.ToUnixTimeSeconds();
olderThanToken = $"{currentTimestamp}:0:a::";
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

this having :0: doesn't replicate the real request a browser makes, but still works. Not really sure what that number is in the API request but it works still...

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

It's the ID of the last album in the initial html document, so it can probably stay as 0 but might look at seeing how hard it is to just parse it out of it as we already make the request.

@fiso64
Copy link
Copy Markdown
Owner

fiso64 commented Nov 23, 2025

Same issue for me as mentioned in #145, as it still relies on extracting the fan id from the html. I'm often blocked because the client fails bandcamp's challenge due to lack of js.

(...)
<title>Client Challenge</title>
(...)
    <noscript>
      <div class="noscript-container">
        <div class="noscript-content">
          <img src="/_fs-ch-1T1wmsGaOgGaSxcX/assets/errorIcon.svg" alt="" role="presentation" class="error-icon">
          <span class="noscript-span">JavaScript is disabled in your browser.</span>
          <p>Please enable JavaScript to proceed.</p>
        </div>
      </div>
    </noscript>
    <div id="loading-error" role="alert" aria-live="polite">
      A required part of this site couldn’t load. This may be due to a browser
      extension, network issues, or browser settings. Please check your
      connection, disable any ad blockers, or try using a different browser.
    </div>
(...)

A solution would probably have to rely exclusively on the API.

@snus-kin
Copy link
Copy Markdown
Author

I guess this is cloudflare or a similar portal type thing? Probably you'll see the same issue with the API. Didn't want to make this properly published for similar reasons of general stability. Deal with this a bunch at work and don't think just running with a headless browser will fix that particular issue.

@fiso64
Copy link
Copy Markdown
Owner

fiso64 commented Nov 23, 2025

Probably you'll see the same issue with the API

Seems that way. Artist retrieval is giving me the same response even though it uses the mobile api.

I've had issues with bandcamp scraping in the past and I was able to resolve them with cloudscraper, although that's a python package. Not sure if it still works or if there is an equivalent in c#.

@snus-kin
Copy link
Copy Markdown
Author

Yeah at work we use a proxy service, scraping from BC will really rely on what your home network is like I guess. Especially if you're running this code on a datacentre IP (vps etc) I bet it'll be bad.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants