easlice / bandcamp-downloader

Download your bandcamp collection using this python script.
MIT License
281 stars 34 forks source link

Allow specifying path for cookies when using --browser #25

Closed Half-Shot closed 4 months ago

Half-Shot commented 8 months ago

For whatever reason on my setup, browser_cookie3 was unable to locate my browser's cookie jar when just using --browser. I've added the option to use the --cookies parameter when specifying --browser to remedy this.

I'm aware though that this is a breaking change, as anyone specifying both currently will have the browser parameter ignored.

As an aside, do we still think http.cookiejar.MozillaCookieJar works? I did try it with my Firefox setup but it was unable to decode my cookie jar, so unless we've got some very old FF users or Netscape users (:grin:), it might not be worth keeping that functionality.

easlice commented 4 months ago

The --cookies option was added by a PR from a user that was using that functionality (they were using an extension to manually pull their cookies from their browser).

One thing I've seen is that the --browser option will fail to find the cookie if the browser is installed through a flatpack or a snap, because the directories for those browsers gets placed into a different set of directories in the home dir. A workaround I've been doing where needed for that is to sym link the dir to where it is normally expected to be.

In regards to this PR, there is one issue: --browser has a default value, so it is always specified, meaning that you'll never get the case where it isn't set but the --cookies is. I'll think on this and either add a commit to fix it, or you can if you get to it before I do.

easlice commented 4 months ago

@Half-Shot Figured it out. This change will first try to act as the old behavior, and if that fails it'll then try and use the --cookies path as the store for your given browser.