mikf / gallery-dl

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

Error downloading redgifs: TypeError: can only concatenate str (not "NoneType") to str #3116

Closed rostam-rakhsh closed 1 year ago

rostam-rakhsh commented 1 year ago

I'm calling the command:

    cmd = f'gallery-dl {url} -d {save_path_dir}'
    sp.call(cmd,shell=True)

Where url is 'https://www.redgifs.com/watch/defenselessbaggyhellbender' and save_path_dir is 'Downloads/saved_reddit/' and I'm getting this issue. Same kind of issue with any other downloader I'm using for redgifs.

Verbose output below:

[gallery-dl][debug] Version 1.23.3
[gallery-dl][debug] Python 3.8.6 - macOS-10.14.6-x86_64-i386-64bit
[gallery-dl][debug] requests 2.28.1 - urllib3 1.26.10
[gallery-dl][debug] Starting DownloadJob for 'https://www.redgifs.com/watch/defenselessbaggyhellbender'
[redgifs][debug] Using RedgifsImageExtractor for 'https://www.redgifs.com/watch/defenselessbaggyhellbender'
[redgifs][debug] Retrieving Bearer token
[urllib3.connectionpool][debug] Starting new HTTPS connection (1): www.redgifs.com:443
[urllib3.connectionpool][debug] https://www.redgifs.com:443 "GET / HTTP/1.1" 200 None
[urllib3.connectionpool][debug] https://www.redgifs.com:443 "GET /assets/js/index.cba1e339.js HTTP/1.1" 200 None
[redgifs][error] An unexpected error occurred: TypeError - can only concatenate str (not "NoneType") to str. Please run gallery-dl again with the --verbose flag, copy its output and report this issue on https://github.com/mikf/gallery-dl/issues .
[redgifs][debug] 
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/gallery_dl/job.py", line 82, in run
    for msg in extractor:
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/gallery_dl/extractor/redgifs.py", line 36, in items
    for gif in self.gifs():
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/gallery_dl/extractor/redgifs.py", line 127, in gifs
    return (RedgifsAPI(self).gif(self.key),)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/gallery_dl/extractor/redgifs.py", line 137, in __init__
    "authorization": "Bearer " + self._fetch_bearer_token(extractor),
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/gallery_dl/cache.py", line 115, in __call__
    value = self.func(*args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/gallery_dl/extractor/redgifs.py", line 182, in _fetch_bearer_token
    token = "ey" + text.extract(page, '="ey', '"')[0]
TypeError: can only concatenate str (not "NoneType") to str
mikf commented 1 year ago

Duplicate of https://github.com/mikf/gallery-dl/issues/3080 (which is pinned). Will be fixed in the next release.