Bandcamp-API
Bandcamp-API copied to clipboard
Additional information on "older_than_token" for item based endpoints
https://github.com/michaelherger/Bandcamp-API/blob/7c30cfc67543e4ad681b98f8e196c3597c3e3bdb/data/bandcamp.yaml#L946-L954
This is merely discoveries from analysis of API responses on my own collection.
The older_than_token
is broken up into 5 parts separated by :
Example partial response from api/fancollection/1/collection_items
{"items": [{
:
"tralbum_type": "a",
"purchased": "06 Feb 2017 02:16:28 GMT",
"tralbum_id": 3314754897,
"token": "1486347388:3314754897:a:2:",
Here's my understanding of the 5 parts:
- Unix epoch timestamp of when fan
"purchased"
this item. -
"tralbum_id"
of the item in question -
"trablum_type"
of the item in question - ~Monotonically~ increasing index of items past initial set on users fan page (index can jump values)
- ?Unused?
Specifically related to api/fancollection/1/collection_items
:
- The timestamp and id are not necessary and can be left blank
::...
- The
tralbum_type
is required to not be empty, but any value is fine::foo:...
- The index value is the only important part for this handler
3.1. Any index value that is not a positive whole number is ignored and treated as an empty value, aka start at the first value you can give. (
::foo::
or::foo:bar:
says start with the first item,::foo:50:
says start with the 51st item) 3.2. This unfortunately means you can't get the extended information about the initial 45 items set on the users fan page (apart from something like automating swapping the first and section 45 item chunks)
First brush it looks like token for /api/fancollection/1/wishlist_items
follows the pattern of /collection_items
. However the 5 fields are:
- Unix epoch timestamp of when fan
"added"
this item - "tralbum_id" of the item in question
- "trablum_type" of the item in question
- ?Unused?
- ?Unused?
In this case it appears that the first three fields are all important for getting consistent responses.
From <div id="pagedata" data-blob="{JSON HERE}">
on your fan page look for .wishlist_data.last_token
.
Specifically related to
api/fancollection/1/collection_items
:
- The timestamp and id are not necessary and can be left blank
::...
- The
tralbum_type
is required to not be empty, but any value is fine::foo:...
- The index value is the only important part for this handler 3.1. Any index value that is not a positive whole number is ignored and treated as an empty value, aka start at the first value you can give. (
::foo::
or::foo:bar:
says start with the first item,::foo:50:
says start with the 51st item) 3.2. This unfortunately means you can't get the extended information about the initial 45 items set on the users fan page (apart from something like automating swapping the first and section 45 item chunks)
Using this as a starting point, I was able to get an entire collection (matching the listed collection size) by setting older_than_token
to f"{int(time.time())}::a::"
(in Python).