mikf / gallery-dl

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

[Hentai-Foundry] An unexpected error occurred: KeyError - "name='YII_CSRF_TOKEN', domain=None, path=None" NSFW #1093

Closed Luxo-007 closed 3 years ago

Luxo-007 commented 3 years ago

[### gallery-dl.conf ###] `{ "extractor": { "base-directory": "E:\Art\", "archive": "F:\gallery-dl\archive.sqlite3", "postprocessors": null, "image-unique": true, "cookies": "F:\gallery-dl\cookies.txt", "cookies-update": true, "proxy": null, "skip": "abort:4", "sleep": 0, "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.102 Safari/537.36", "restrict-filenames": "auto", "blacklist": "foobar",

    "deviantart":
    {
        "username": [redacted],
        "password": [redacted],
        "refresh-token": [redacted],
        "client_id": [redacted],
        "client_secret": [redacted],
        "extra": false,
        "flat": true,
        "folders": false,
        "include": "all",
        "journals": "none",
        "mature": true,
        "metadata": false,
        "original": true,
        "sleep": 4
    },
    "instagram":
    {
        "username": [redacted],
        "password": [redacted]
    },
    "patreon":
    {
        "username": [redacted],
        "password": [redacted]
    },
    "gfycat":
    {
        "format": "mp4"
    },
    "oauth":
    {
        "browser": true
    },
    "recursive":
    {
        "blacklist": ["directlink", "oauth", "recursive", "test"]
    },
    "tumblr":
    {
        "username": [redacted],
        "password": [redacted],
        "OAuth Consumer Key": [redacted],
        "Secret Key": [redacted],
        "avatar": false,
        "external": false,
        "inline": true,
        "posts": "all",
        "reblogs": true
    },
    "twitter":
    {
        "username": [redacted],
        "password": [redacted],
        "content": false,
        "retweets": true,
        "videos": true
    },
    "pixiv":
    {
        "filename": "{id}{num}.{extension}",
        "directory": ["Pixiv", "Works", "{user[id]}"],
        "username": [redacted],
        "password": [redacted],
        "favorite":
        {
            "directory": ["Pixiv", "Favorites", "{user[id]}"]
        }
    },
    "hentaifoundry":
    {   
        "username": [redacted],
        "password": [redacted]
    }
},

"downloader":
{
    "part": true,
    "part-directory": null,

    "http":
    {
        "mtime": true,
        "rate": null,
        "retries": 4,
        "timeout": 30.0,
        "verify": true
    },

    "ytdl":
    {
        "format": null,
        "forward-cookies": false,
        "mtime": true,
        "rate": null,
        "retries": 4,
        "timeout": 30.0,
        "verify": true,
        "logging": true,
        "raw-options":
        {
            "verbose": true
        }
    }
},

"output":
{
    "mode": "auto",
    "progress": true,
    "shorten": true,
    "level": "debug",
    "log": "[{name}][{levelname}] {message}",
    "logfile": {
        "path": "F:\\gallery-dl\\output.txt",
        "mode": "a"
        },
    "unsupportedfile": {
        "path": "F:\\gallery-dl\\output-unsup.txt",
        "mode": "a"
        }
},
"cache": {
    "file": "F:\\gallery-dl\\cache.sqlite3"
},

"netrc": false

}` [### End of gallery-dl.conf ###]

[### Verbose output ###] [gallery-dl][debug] Version 1.15.2 [gallery-dl][debug] Python 3.8.2 - Windows-10-10.0.18362-SP0 [gallery-dl][debug] requests 2.23.0 - urllib3 1.25.8 [gallery-dl][debug] Starting DownloadJob for 'http://www.hentai-foundry.com/pictures/user/34san' [hentaifoundry][debug] Using HentaifoundryPicturesExtractor for 'http://www.hentai-foundry.com/pictures/user/34san' [urllib3.connectionpool][debug] Starting new HTTPS connection (1): www.hentai-foundry.com:443 [urllib3.connectionpool][debug] https://www.hentai-foundry.com:443 "HEAD /?enterAgree=1 HTTP/1.1" 200 0 [hentaifoundry][error] An unexpected error occurred: KeyError - "name='YII_CSRF_TOKEN', domain=None, path=None". Please run gallery-dl again with the --verbose flag, copy its output and report this issue on https://github.com/mikf/gallery-dl/issues . [hentaifoundry][debug] Traceback (most recent call last): File "f:\python\lib\site-packages\gallery_dl\job.py", line 67, in run for msg in self.extractor: File "f:\python\lib\site-packages\gallery_dl\extractor\hentaifoundry.py", line 34, in items self._init_site_filters() File "f:\python\lib\site-packages\gallery_dl\extractor\hentaifoundry.py", line 151, in _init_site_filters response.cookies["YII_CSRF_TOKEN"], "%22", "%22")[0]), File "f:\python\lib\site-packages\requests\cookies.py", line 328, in getitem return self._find_no_duplicates(name) File "f:\python\lib\site-packages\requests\cookies.py", line 399, in _find_no_duplicates raise KeyError('name=%r, domain=%r, path=%r' % (name, domain, path)) KeyError: "name='YII_CSRF_TOKEN', domain=None, path=None" [### Verbose output ###] [gallery-dl][debug] Version 1.15.2 [gallery-dl][debug] Python 3.8.2 - Windows-10-10.0.18362-SP0 [gallery-dl][debug] requests 2.23.0 - urllib3 1.25.8 [gallery-dl][debug] Starting DownloadJob for 'http://www.hentai-foundry.com/pictures/user/aaaninja' [hentaifoundry][debug] Using HentaifoundryPicturesExtractor for 'http://www.hentai-foundry.com/pictures/user/aaaninja' [urllib3.connectionpool][debug] Starting new HTTPS connection (1): www.hentai-foundry.com:443 [urllib3.connectionpool][debug] https://www.hentai-foundry.com:443 "HEAD /?enterAgree=1 HTTP/1.1" 200 0 [hentaifoundry][error] An unexpected error occurred: KeyError - "name='YII_CSRF_TOKEN', domain=None, path=None". Please run gallery-dl again with the --verbose flag, copy its output and report this issue on https://github.com/mikf/gallery-dl/issues . [hentaifoundry][debug] Traceback (most recent call last): File "f:\python\lib\site-packages\gallery_dl\job.py", line 67, in run for msg in self.extractor: File "f:\python\lib\site-packages\gallery_dl\extractor\hentaifoundry.py", line 34, in items self._init_site_filters() File "f:\python\lib\site-packages\gallery_dl\extractor\hentaifoundry.py", line 151, in _init_site_filters response.cookies["YII_CSRF_TOKEN"], "%22", "%22")[0]), File "f:\python\lib\site-packages\requests\cookies.py", line 328, in getitem return self._find_no_duplicates(name) File "f:\python\lib\site-packages\requests\cookies.py", line 399, in _find_no_duplicates raise KeyError('name=%r, domain=%r, path=%r' % (name, domain, path)) KeyError: "name='YII_CSRF_TOKEN', domain=None, path=None" [### End of Output ###]

mikf commented 3 years ago

This a duplicate of #1083 and was already fixed in 0211af7c. To get it to work with the current version, disable the global cookies.txt file for hentaifoundry as described in https://github.com/mikf/gallery-dl/issues/1083#issuecomment-718196550

And some comments about your config file:

Option names are always lower case and use - as separator.

Luxo-007 commented 3 years ago

Thanks for the reply. Implemented the changes.