Closed yoshiyoshyosh closed 6 months ago
that's annoying. I thought I covered everything, but check out this album: https://pekano.bandcamp.com/album/jungle-stab
"freeDownloadPage": "https://bandcamp.com/download?id=1608026956&ts=1712937230.237207704&tsig=9478d89ad962cc6db5ab43059ddfeab8&type=album",
without any tracks, which raises a KeyError
when it goes to download a format that doesn't exist
alternative idea: there's a second JSON thingy that contains album metadata in the <head>
, which can be isolated by searching only for head > script[type="application/ld+json"]
. here's an example of me getting album metadata from it: https://git.unix.dog/yosh/misc-scripts/src/commit/4e839b2406b8397b53aa3f6c79651f1ff70c35bd/discogarchive#L184
or I guess we can move a strict track-check within the if statement
thoughts?
that's annoying. I thought I covered everything, but check out this album: https://pekano.bandcamp.com/album/jungle-stab
"freeDownloadPage": "https://bandcamp.com/download?id=1608026956&ts=1712937230.237207704&tsig=9478d89ad962cc6db5ab43059ddfeab8&type=album",
without any tracks, which raises aKeyError
when it goes to download a format that doesn't exist
I think that is a separate issue which also exists in the current version
alternative idea: there's a second JSON thingy that contains album metadata in the
<head>
, which can be isolated by searching only forhead > script[type="application/ld+json"]
. here's an example of me getting album metadata from it: https://git.unix.dog/yosh/misc-scripts/src/commit/4e839b2406b8397b53aa3f6c79651f1ff70c35bd/discogarchive#L184or I guess we can move a strict track-check within the if statement
thoughts?
Anything involving counting the number of tracks I would worry about how it handles albums with "hidden tracks" (i.e. would it download an album which has no publicly visible tracks?)
I think the "hasAudio" key in tralbum_data might work, can you test that out?
Anything involving counting the number of tracks I would worry about how it handles albums with "hidden tracks" (i.e. would it download an album which has no publicly visible tracks?)
do you have an example of this on hand?
I thiiiink that should cover it--downloads that test album, the album I raised this for, and doesn't raise an error on jungle stab.
Actually, I think it'd be better if we put the audio check outside of the main check. Makes more sense for it to be there.
I'll be damned. It's possible to have a free download album that requires email, which evades these checks: https://treecritters.bandcamp.com/album/real-trap-shit
I believe the only way to get around this is using the metadata from head > script[type="application/ld+json"
: https://x0.at/DPaz.txt
alright, here's what I've got so far:
hasAudio
. if not, then don't download, of coursehead > script[type="application/ld+json"]
albumRelease
list where it has an additionalProperty
with an item_type
of a
or t
. these correspond to digital album or digital track releases, respectively. physical releases use p
and discography offerings use b
offers
available for this digital release, because there do exist albums on bandcamp that don't offer a digital formathead_data
rather than the data-tralbum
. from my testing over months with my discography archive script, this has always been a correct reflection of the current album price for mealbums I tested this on that work as expected:
this should cover everything now... the only weird edge case I think might exist is offers
containing multiple objects, but I have never seen that ever, nor would I think bandcamp would have an inconsistent list-if-multiple object-if-single object in their data... but you never know
I believe that free download albums where the fallback price is > 0 causes bcdl-free to think that the album isn't free, when it really is
case study: https://dj-bamberino.bandcamp.com/album/bittersweet-saffron relevant
data-tralbum
:proposed fix: check if
freeDownloadPage
is not null in the same check astralbum_data["current"]["minimum_price"] == 0
tested on the above album & some others, everything seems good