meeb / bandcampsync

Downloads your Bandcamp purchases automatically
BSD 3-Clause "New" or "Revised" License
156 stars 9 forks source link

Failed to parse pagedata JSON, "identities.fan" is not a dictionary. #20

Closed Virusmater closed 5 months ago

Virusmater commented 5 months ago

Since some time I have the following error in the logs:

2024-06-13 16:50:42,462 media [INFO] Detected locally downloaded media: 106825944 = /downloads/Throwing Bricks & Ontaard/Oud Zeer
2024-06-13 16:50:42,462 bandcamp [INFO] Located Bandcamp session in cookies: 1%09t%3A1704229623%0...
Traceback (most recent call last):
  File "/usr/local/bin/bandcampsync-service", line 75, in <module>
    do_sync(cookies_path, cookies, dir_path, media_format_env, temp_dir, ign_patterns)
  File "/usr/local/lib/python3.11/dist-packages/bandcampsync/__init__.py", line 19, in do_sync
    bandcamp.verify_authentication()
  File "/usr/local/lib/python3.11/dist-packages/bandcampsync/bandcamp.py", line 161, in verify_authentication
    raise BandcampError(f'Failed to parse pagedata JSON, "identities.fan" is not '
bandcampsync.bandcamp.BandcampError: Failed to parse pagedata JSON, "identities.fan" is not a dictionary. Check your cookies.txt file is valid and up to date

Any idea how to fix it?

meeb commented 5 months ago

Have you checked that your cookies.txt file is valid and up to date?

Virusmater commented 5 months ago

Yeah, after regenerating cookies it worked out. Any idea how often they are set to expire?

meeb commented 5 months ago

bandcampsync will automatically refresh your cookies.txt when it runs so providing you run the script periodically (or automatically on a timer via the Docker container for example) they generally shouldn't expire. If you only run the script occasionally then no idea it's up to Bandcamp.

This is similar to a question of "how long will I remain logged into a website if I close my browser?". Bandcamp generally seem to set cookies with an expiry of between 30 and 45 or so days but that's no guarantee that's now long they will remain valid if you don't refresh them. They can always force-expire your session token stored in the cookies although I've never seen that happen myself.

However, if you do see that error randomly then refreshing your cookies should fix it so it's not a major issue.

meeb commented 5 months ago

I'll close this for now. Feel free to comment if you continue to have issues.