mikf / gallery-dl

Command-line program to download image galleries and collections from several image hosting sites
GNU General Public License v2.0
11.95k stars 975 forks source link

So Reddit is not supported yet ? #104

Closed wankio closed 6 years ago

wankio commented 6 years ago

Today when i test reddit, it have this error

reddit: Conflicting values for 'client-id' and 'user-agent': override either both or none of them.

reddit: An unexpected error occurred: ValueError - substring not found. Please run gallery-dl again with the --verbose flag, copy its output and report this issue on https://github.com/mikf/gallery-dl/issues .
reddit: Traceback
Traceback (most recent call last):
  File "c:\users\gen31uc\appdata\local\programs\python\python37\lib\site-packages\gallery_dl\job.py", line 64, in run
    for msg in self.extractor:
  File "c:\users\gen31uc\appdata\local\programs\python\python37\lib\site-packages\gallery_dl\extractor\reddit.py", line 39, in items
    for url in self._urls(submissions):
  File "c:\users\gen31uc\appdata\local\programs\python\python37\lib\site-packages\gallery_dl\extractor\reddit.py", line 63, in _urls
    for submission, comments in submissions:
  File "c:\users\gen31uc\appdata\local\programs\python\python37\lib\site-packages\gallery_dl\extractor\reddit.py", line 258, in _pagination
    id_max = self._parse_id("id-max", 2147483647)
  File "c:\users\gen31uc\appdata\local\programs\python\python37\lib\site-packages\gallery_dl\extractor\reddit.py", line 307, in _parse_id
    return self._decode(sid.rpartition("_")[2]) if sid else default
  File "c:\users\gen31uc\appdata\local\programs\python\python37\lib\site-packages\gallery_dl\extractor\reddit.py", line 311, in _decode
    return util.bdecode(sid, "0123456789abcdefghijklmnopqrstuvwxyz")
  File "c:\users\gen31uc\appdata\local\programs\python\python37\lib\site-packages\gallery_dl\util.py", line 90, in bdecode
    num += alphabet.index(c)
ValueError: substring not found
Hrxn commented 6 years ago

Well, it was working just fine before.. But yeah, Reddit got a site redesign pretty recently, and I think the official switch has been made not long ago. So that is probably the cause here..

wankio commented 6 years ago

ripme still work but it failed to merge audio, so i think tt has changed recently

mikf commented 6 years ago

The cause for this error was the value for id-max in the default config file, ZIK0ZJ, and its uppercase letters. _parse_id() and _decode() in the reddit module convert reddit submission IDs (like ZIK0ZJ) into actual numbers, but they expect lowercase letters. Anyways, it's fixed now (hopefully).

wankio commented 6 years ago

ty but when i test it

reddit: Conflicting values for 'client-id' and 'user-agent': override either both or none of them. reddit: Requesting public access token reddit: Authentication failed: "Unauthorized (401)"

mikf commented 6 years ago

This is another issue caused by conflicting values in the default config file ... I should've tested them a bit better, sorry about that.

To get things working, either delete the general user-agent setting somewhere at the top of your config file, or set the user-agent for reddit to "Python:gallery-dl:0.8.4 (by /u/mikf1)". Both should work.

wankio commented 6 years ago

tested and worked now, thank you :)

mikf commented 6 years ago

Set comments to 0 if you don't want it to go through user comments and get URLs from there as well.

The directory structure for Reddit downloads is a bit unfortunate, I agree, but "fixing" it isn't really possible with how things work internally. Getting this right is a goal for v2.0.0 for sure, but for right now you will have to manually set the base-directory to get it to do what you want.


$ gallery-dl -d BokuNoEroAcademia https://www.reddit.com/r/BokuNoEroAcademia/
# or
$ gallery-dl -o base-directory=BokuNoEroAcademia https://www.reddit.com/r/BokuNoEroAcademia/
wankio commented 6 years ago

ty u are awesome :) , that's what i'm thought