bulk-downloader-for-reddit
bulk-downloader-for-reddit copied to clipboard
[BUG] Cannot select new account to authenticate even after deleting default_config.cfg
- [ X] I am reporting a bug.
- [ X] I am running the latest version of BDfR
- [x] I have read the Opening an issue
Description
I want to use a different account to download saved posts off, but I can change what account it uses even after deleting the config here: C:\Users\egg\AppData\Local\BDFR\bdfr\default_config.cfg
Command
bdfr clone "D:/RedditBackup/2/Saved" --authenticate --user me --saved
Environment (please complete the following information)
- OS: [Windows 10]
- Python version: [3.10.9]
Logs
[log_output.txt]:
[2023-06-12 10:14:01,636 - bdfr.connector - DEBUG] - Disabling the following modules:
[2023-06-12 10:14:01,636 - bdfr.connector - Level 9] - Created download filter
[2023-06-12 10:14:01,636 - bdfr.connector - Level 9] - Created time filter
[2023-06-12 10:14:01,636 - bdfr.connector - Level 9] - Created sort filter
[2023-06-12 10:14:01,653 - bdfr.connector - Level 9] - Create file name formatter
[2023-06-12 10:14:01,653 - bdfr.connector - DEBUG] - Using authenticated Reddit instance
[2023-06-12 10:14:01,653 - bdfr.oauth2 - Level 9] - Loaded OAuth2 token for authoriser
[2023-06-12 10:14:01,935 - bdfr.oauth2 - Level 9] - Written OAuth2 token from authoriser to C:\Users\egg\AppData\Local\BDFR\bdfr\default_config.cfg
[2023-06-12 10:14:02,211 - bdfr.connector - Level 9] - Resolved user to [WRONG USER]
[2023-06-12 10:14:02,212 - bdfr.connector - Level 9] - Created site authenticator
[2023-06-12 10:14:02,212 - bdfr.connector - Level 9] - Retrieved subreddits
[2023-06-12 10:14:02,212 - bdfr.connector - Level 9] - Retrieved multireddits
[2023-06-12 10:14:02,418 - bdfr.connector - DEBUG] - Retrieving saved posts of user [WRONG USER]
[2023-06-12 10:14:02,418 - bdfr.connector - Level 9] - Retrieved user data
[2023-06-12 10:14:02,419 - bdfr.connector - Level 9] - Retrieved submissions for given links
[Here it just starts downloading from the wrong account]
I just came here to say this.
I am using bdfr in WSL (ubuntu 22.04) and have deleted the relevant config files.
All I would need/want is a clarification of the README.md about exactly what needs to be deleted.
Specifically I want to know how to retrigger the auth that happens when the reddit page opens in the browser.
I haven't tried running it inside a docker container inside WSL which might be next as a workaround.
(PS to the maintainers. I love this tool. Thank you for all your hard work.)
Hello, I got re-authenticate to work by delteing the correct config file.
I use debian so for me it was $HOME/.config/bdfr/default_config.cfg
.
You should know if it is the correct file to delete if it has a user_token
saved in it, although you can probably just delete that line by itself.
ok, found it. I installed bdfr using pipx
, so there were some leftover configs.
You would expect deleting $HOME/.config/bdfr/default_config.cfg
would be it but I found my user_token in this file as well:
$HOME/.local/pipx/venvs/bdfr/lib/python3.9/site-packages/bdfr/default_config.cfg
Deleting this broke the installation so I just reinstalled using pipx
.
(ripgrep was what I used to hunt down the token and find this other config file btw.)
That is...strange. Pipx is not doing normal things there, it's changing system paths and the way that the BDFR finds files. The solution for this PR is probably having a logging message that tells where the configuration has been loaded from.
After more consideration is there an command line flag you could add to BDFR to force a re-authentication? I think that would be more ergonomic as far as wanting to switch between different users/sessions.
We can but that might lead to unintended consequences. With Reddit getting more strict (insane, imo) with their API, they might not respond kindly to users authenticating many apps. If users can't find the config file to edit, or use the command options to use different configuration files, then I think they're likely to just keep registering new applications every time they want to switch accounts. That might draw Reddit's attention in an unfriendly way.
I had an identical issue. Thanks @jameshounshell for the pointers. In my case, default_config.cfg
was also saved in two places:
-
%APPDATA%/local/bdfr/Programs\Python\Python311\config\default_config.cfg
-
%APPDATA%/local/bdfr/Programs\Python\Python311\Lib\site-packages\bdfr\default_config.cfg
The fix was as follows:
- Manually delete both directories listed above
- Run
pip install --upgrade --force-reinstall bdfr
Both those steps needed to be performed as written. Just deleting the directories/files broke the install. Just reinstalling didn't prevent BDFR finding the previous token. After doing both, the next run of BDFR requested authentication as it should.