aliparlakci / bulk-downloader-for-reddit

Downloads and archives content from reddit
https://pypi.org/project/bdfr
GNU General Public License v3.0
2.26k stars 211 forks source link

[BUG] Error when sending a command that requires authentication #941

Open DasMadScientist opened 5 months ago

DasMadScientist commented 5 months ago

Description

I was trying to check how BDfR worked, and I tried to run a command to download my saved posts, but when it tried to authenticate me, it errored into those logs I posted. I already configured the config file putting my client ID and secret (I actually did it three times as I tried an older one, but also created a couple more for scripts and web apps), and BDfR works normally not counting the auth thing. But I'm stuck at auth when I try something like downloading saved posts or upvotes. Thanks in advance.

Command

bdfr download ./downloads --user me --saved --authenticate
bdfr download ./downloads --user me --saved --authenticate -L 25 --file-scheme '{POSTID}'
bdfr download ./downloads --user me --saved --authenticate --file-scheme '{POSTID}'
bdfr download ./downloads --user me --upvoted  --authenticate

Environment

Logs

log_output.txt

[2024-02-05 03:39:54,971 - bdfr.connector - DEBUG] - Disabling the following modules: 
[2024-02-05 03:39:54,972 - bdfr.connector - Level 9] - Created download filter
[2024-02-05 03:39:54,972 - bdfr.connector - Level 9] - Created time filter
[2024-02-05 03:39:54,972 - bdfr.connector - Level 9] - Created sort filter
[2024-02-05 03:39:55,013 - bdfr.connector - Level 9] - Create file name formatter
[2024-02-05 03:39:55,013 - bdfr.connector - DEBUG] - Using authenticated Reddit instance
[2024-02-05 03:39:55,014 - bdfr.connector - Level 9] - Commencing OAuth2 authentication
[2024-02-05 03:39:55,500 - root - ERROR] - Downloader exited unexpectedly
Traceback (most recent call last):
  File "C:\Users\Dashy\AppData\Local\Programs\Python\Python312\Lib\site-packages\requests\models.py", line 971, in json
    return complexjson.loads(self.text, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Dashy\AppData\Local\Programs\Python\Python312\Lib\json\__init__.py", line 346, in loads
    return _default_decoder.decode(s)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Dashy\AppData\Local\Programs\Python\Python312\Lib\json\decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Dashy\AppData\Local\Programs\Python\Python312\Lib\json\decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Dashy\AppData\Local\Programs\Python\Python312\Lib\site-packages\bdfr\__main__.py", line 117, in cli_download
    reddit_downloader = RedditDownloader(config, [stream])
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Dashy\AppData\Local\Programs\Python\Python312\Lib\site-packages\bdfr\downloader.py", line 41, in __init__
    super(RedditDownloader, self).__init__(args, logging_handlers)
  File "C:\Users\Dashy\AppData\Local\Programs\Python\Python312\Lib\site-packages\bdfr\connector.py", line 63, in __init__
    self._setup_internal_objects()
  File "C:\Users\Dashy\AppData\Local\Programs\Python\Python312\Lib\site-packages\bdfr\connector.py", line 80, in _setup_internal_objects
    self.create_reddit_instance()
  File "C:\Users\Dashy\AppData\Local\Programs\Python\Python312\Lib\site-packages\bdfr\connector.py", line 139, in create_reddit_instance
    oauth2_authenticator = OAuth2Authenticator(
                           ^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Dashy\AppData\Local\Programs\Python\Python312\Lib\site-packages\bdfr\oauth2.py", line 21, in __init__
    self._check_scopes(wanted_scopes)
  File "C:\Users\Dashy\AppData\Local\Programs\Python\Python312\Lib\site-packages\bdfr\oauth2.py", line 31, in _check_scopes
    known_scopes = [scope for scope, data in response.json().items()]
                                             ^^^^^^^^^^^^^^^
  File "C:\Users\Dashy\AppData\Local\Programs\Python\Python312\Lib\site-packages\requests\models.py", line 975, in json
    raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)