bulk-downloader-for-reddit icon indicating copy to clipboard operation
bulk-downloader-for-reddit copied to clipboard

Can't get bdfr to authenticate new user

Open FowadIjaz opened this issue 3 years ago • 1 comments

  • [ x] I am reporting a bug.
  • [ x] I am running the latest version of BDfR
  • [ x] I have read the Opening an issue

Description

Discussed in https://github.com/aliparlakci/bulk-downloader-for-reddit/discussions/599

Originally posted by FowadIjaz February 16, 2022 Hi all, great tool, I'm trying to use a different user than the one I've been using previously, but when I do it returns 403 forbidden when it should redirect me to a link to authenticate according to the docs. I've tried with and without the --authenticate tag and the script crashes both ways.

I've tried going to the default_config.cfg file in Appdata\Local\BDFR\bdfr and moving it out, because I figured if it's not already there the script would autogenerate it, but that didn't appear to work. I've tried using venvs to run the script, but they seem to pull from the default_config.cfg file as well. I tried adding a config.cfg file to the folder with nothing in it, and it threw an error saying [DEFAULT] must be specified. I tried copying in all the parameters and setting them to NaN but that also didn't work.

Appreciate any help...

Command

python -m bdfr clone ./Test --user newuser --upvoted --authenticate --limit 40 --file-scheme '{POSTID},{REDDITOR},{TITLE}' --no-dupes --search-existing

Environment (please complete the following information):

  • OS: Windows 10
  • Python version: 3.9.5

Logs

[2022-02-18 00:48:08,560 - bdfr.connector - DEBUG] - Setting maximum download wait time to 120 seconds
[2022-02-18 00:48:08,561 - bdfr.connector - DEBUG] - Setting datetime format string to ISO
[2022-02-18 00:48:08,561 - bdfr.connector - DEBUG] - Disabling the following modules: 
[2022-02-18 00:48:08,562 - bdfr.connector - Level 9] - Created download filter
[2022-02-18 00:48:08,562 - bdfr.connector - Level 9] - Created time filter
[2022-02-18 00:48:08,562 - bdfr.connector - Level 9] - Created sort filter
[2022-02-18 00:48:08,562 - bdfr.connector - Level 9] - Create file name formatter
[2022-02-18 00:48:08,562 - bdfr.connector - DEBUG] - Using authenticated Reddit instance
[2022-02-18 00:48:08,660 - bdfr.connector - Level 9] - Created site authenticator
[2022-02-18 00:48:08,660 - bdfr.connector - Level 9] - Retrieved subreddits
[2022-02-18 00:48:08,661 - bdfr.connector - Level 9] - Retrieved multireddits
[2022-02-18 00:48:08,661 - bdfr.oauth2 - Level 9] - Loaded OAuth2 token for authoriser
[2022-02-18 00:48:08,863 - bdfr.oauth2 - Level 9] - Written OAuth2 token from authoriser to C:\Users\yolo\AppData\Local\BDFR\bdfr\default_config.cfg
[2022-02-18 00:48:09,119 - bdfr.connector - DEBUG] - Retrieving upvoted posts of user ['ShockBeginning8667']
[2022-02-18 00:48:09,119 - bdfr.connector - Level 9] - Retrieved user data
[2022-02-18 00:48:09,119 - bdfr.connector - Level 9] - Retrieved submissions for given links
[2022-02-18 00:48:09,120 - bdfr.downloader - INFO] - Calculating hashes for 0 files
[2022-02-18 00:48:09,379 - root - ERROR] - Scraper exited unexpectedly
Traceback (most recent call last):
  File "C:\Program Files\Python39\lib\site-packages\bdfr\__main__.py", line 120, in cli_clone
    reddit_scraper.download()
  File "C:\Program Files\Python39\lib\site-packages\bdfr\cloner.py", line 19, in download
    for submission in generator:
  File "C:\Program Files\Python39\lib\site-packages\praw\models\listing\generator.py", line 63, in __next__
    self._next_batch()
  File "C:\Program Files\Python39\lib\site-packages\praw\models\listing\generator.py", line 73, in _next_batch
    self._listing = self._reddit.get(self.url, params=self.params)
  File "C:\Program Files\Python39\lib\site-packages\praw\reddit.py", line 573, in get
    return self._objectify_request(method="GET", params=params, path=path)
  File "C:\Program Files\Python39\lib\site-packages\praw\reddit.py", line 674, in _objectify_request
    self.request(
  File "C:\Program Files\Python39\lib\site-packages\praw\reddit.py", line 856, in request
    return self._core.request(
  File "C:\Program Files\Python39\lib\site-packages\prawcore\sessions.py", line 330, in request
    return self._request_with_retries(
  File "C:\Program Files\Python39\lib\site-packages\prawcore\sessions.py", line 266, in _request_with_retries
    raise self.STATUS_EXCEPTIONS[response.status_code](response)
prawcore.exceptions.Forbidden: received 403 HTTP response

FowadIjaz avatar Feb 18 '22 05:02 FowadIjaz

I just wrote a quick bash script for my multiple accounts that restores it to the default value:

logout.bat

(
echo [DEFAULT]
echo client_id = U-6gk4ZCh3IeNQ
echo client_secret = 7CZHY6AmKweZME5s50SfDGylaPg
echo scopes = identity, history, read, save
echo backup_log_count = 20
echo max_wait_time = 120
)>%LocalAppData%\BDFR\bdfr\default_config.cfg

Although an option to enable switching between accounts would be nice.

Fakeaccount12312 avatar Mar 11 '22 14:03 Fakeaccount12312