Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using chrome as the cookie source fails with "Unable to get key for cookie decryption" #17

Open
JOJ0 opened this issue Mar 17, 2023 · 1 comment
Labels
upstream issue It is a bug, but it is a bug with an upstream module and needs to be fixed there.

Comments

@JOJ0
Copy link

JOJ0 commented Mar 17, 2023

It's not a big deal for me since I just launched firefox and logged in with that. Done. Just so you know, there might be an issue. The actual proplem I suppose is happening earlier at: ValueError: invalid padding byte

$ ./bandcamp-downloader.py -v --browser chrome -d ~/0-incoming-bandcamp/ my-bandcamp-user
Namespace(username='my-bandcamp-user', browser='chrome', cookies=None, directory='/home/jojo/0-incoming-bandcamp/', filename_format='{artist}/{artist} - {title}', format='mp3-320', parallel_downloads=5, force=False, wait_after_download=1, max_download_attempts=5, retry_wait=5, verbose=1)
Retrieving album links from user [jojotodos]'s collection.
Traceback (most recent call last):
  File "/home/jojo/.pyenv/versions/bandcamp/lib/python3.10/site-packages/browser_cookie3/__init__.py", line 352, in _decrypt
    decrypted += cipher.feed()
  File "/home/jojo/.pyenv/versions/bandcamp/lib/python3.10/site-packages/pyaes/blockfeeder.py", line 169, in feed
    result = self._final(self._buffer, self._padding)
  File "/home/jojo/.pyenv/versions/bandcamp/lib/python3.10/site-packages/pyaes/blockfeeder.py", line 77, in _block_final_decrypt
    return strip_PKCS7_padding(self.decrypt(data))
  File "/home/jojo/.pyenv/versions/bandcamp/lib/python3.10/site-packages/pyaes/util.py", line 58, in strip_PKCS7_padding
    raise ValueError("invalid padding byte")
ValueError: invalid padding byte

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/jojo/git/bandcamp-downloader/./bandcamp-downloader.py", line 336, in <module>
    sys.exit(main())
  File "/home/jojo/git/bandcamp-downloader/./bandcamp-downloader.py", line 149, in main
    links = get_download_links_for_user(args.username)
  File "/home/jojo/git/bandcamp-downloader/./bandcamp-downloader.py", line 189, in get_download_links_for_user
    cookies = get_cookies()
  File "/home/jojo/git/bandcamp-downloader/./bandcamp-downloader.py", line 331, in get_cookies
    return func(domain_name = 'bandcamp.com')
  File "/home/jojo/.pyenv/versions/bandcamp/lib/python3.10/site-packages/browser_cookie3/__init__.py", line 630, in chrome
    return Chrome(cookie_file, domain_name, key_file).load()
  File "/home/jojo/.pyenv/versions/bandcamp/lib/python3.10/site-packages/browser_cookie3/__init__.py", line 291, in load
    value = self._decrypt(value, enc_value)
  File "/home/jojo/.pyenv/versions/bandcamp/lib/python3.10/site-packages/browser_cookie3/__init__.py", line 354, in _decrypt
    raise BrowserCookieError('Unable to get key for cookie decryption')
browser_cookie3.BrowserCookieError: Unable to get key for cookie decryption
@easlice
Copy link
Owner

easlice commented Mar 17, 2023

This seems to be an issue with the cookie lib that we use, as reported here:
borisbabic/browser_cookie3#141

If I get some time I might look into the upstream issue, as it is odd that a minor python change might have changed dependencies enough for this to happen.

Thanks for reporting this!

@easlice easlice added the upstream issue It is a bug, but it is a bug with an upstream module and needs to be fixed there. label Mar 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
upstream issue It is a bug, but it is a bug with an upstream module and needs to be fixed there.
Projects
None yet
Development

No branches or pull requests

2 participants