mikf / gallery-dl

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

Config Problem "DirectoryFormatError: Applying directory format string failed (ValueError: Single '{' encountered in format string)" and a "HTML /1,1 200 None" error #5004

Closed EnchantedSIMCard closed 9 months ago

EnchantedSIMCard commented 9 months ago

I tried to download something from FurAffinity (NSFW links are included) as a test before downloading bigger galleries and I came across a few errors. My memory is hazy but I was fixing up the config so it could run (based on my DeviantArt config but tweaked for FurAffinity).

The first error I encountered was "[furaffinity][error] DirectoryFormatError: Applying directory format string failed (ValueError: Single '{' encountered in format string)".

[gallery-dl][debug] Version 1.26.3 - Executable
[gallery-dl][debug] Python 3.8.10 - Windows-10-10.0.19045
[gallery-dl][debug] requests 2.31.0 - urllib3 2.1.0
[gallery-dl][debug] Configuration Files ['C:\\Users\\xxxxx\\AppData\\Roaming\\gallery-dl\\furaffinity.json']
[gallery-dl][debug] Starting DownloadJob for 'https://www.furaffinity.net/user/cronanevermore'
[furaffinity][debug] Using FuraffinityUserExtractor for 'https://www.furaffinity.net/user/cronanevermore'
[furaffinity][debug] Using FuraffinityGalleryExtractor for 'https://www.furaffinity.net/gallery/cronanevermore/'
[furaffinity][debug] Loading cookies from 'C:/Root Programs/Downloaders/gallery-dl/cookies/cookies-www-furaffinity-net.txt'
[furaffinity][warning] no 'a' and 'b' session cookies set
[urllib3.connectionpool][debug] Starting new HTTPS connection (1): www.furaffinity.net:443
[urllib3.connectionpool][debug] https://www.furaffinity.net:443 "GET /gallery/cronanevermore/1/ HTTP/1.1" 200 None
[urllib3.connectionpool][debug] https://www.furaffinity.net:443 "GET /view/54398622/ HTTP/1.1" 200 None
[furaffinity][error] DirectoryFormatError: Applying directory format string failed (ValueError: Single '{' encountered in format string)

At first, I assumed the issue was with the keywords because using -K on the URL didn't have the same options as when I did it for DeviantArt. Despite using the only wanted keywords provided in the command, this issue persisted.

I don't remember precisely the steps I took to try to fix this afterward, but I tweaked the directory command in slightly different variations with different strings (including using strings from my DeviantArt config to see if it worked again) and even removing the directory part to no avail. What was confusing to me was that my DeviantArt config ran just fine with the singular string in the directory which looked like this "author['username']".

One of them was removing the curly braces as it's what I interpreted from this post on the issue "https://github.com/mikf/gallery-dl/issues/245", which did run but the directory string was split into characters (After a while, I read further into the issue and found another issue that had separated letters. Except in my case, it was with the config and not any command line as I use a batch file) and a new error entered my vision, "GET /view/xxxxx/ HTTP/1.1" 200 None".

In this image, I ran the config without the directory command and this was the result to replicate what I saw

frustrtaging

The second one is far stranger and more obscure than the first issue. I searched with DuckDuckGo and found zero results for it. Even though it ran, it didn't download anything because it seems the GET request found nothing.

Here are the relevant parts of my config for inspection. Keep in mind that the directory option was moved down below the filename and of course, all the string adjustments I tried. Moving it up or down does nothing to help though.

"furaffinity": {
            "cookies": "C:/Root Programs/Downloaders/gallery-dl/cookies/cookies-www-furaffinity-net.txt",
            "archive": "C:/Users/adir1/AppData/Roaming/gallery-dl/furaffinity_ids.txt",
            "username": "***",
            "password": "***",
            "base-directory": "D:/Files (General)/Randy/(gallery-dl)/FurAffinity",
        "filename": "{filename}_{extension}", 
        "directory": "{artist}",
            "descriptions": "text",
            "external": false,
            "include": "gallery, scraps",
            "layout": "auto",
            "mature": true
        }

How to fix the second problem is something I have NO CLUE about. So if anyone knows about this error in particular, please reply to this post.

mikf commented 9 months ago

"directory": "{artist}",

Change that to "directory": ["{artist}"],

"include": "gallery, scraps",

Change that to "include": ["gallery", "scraps"], or "include": "gallery,scraps",

Your current settings will work in the next release (f36dafad), but for now it needs to be either a list or a string with no whitespace.

"username": "***",

Login with username & password is not supported for FA. You need to use cookies, for example like this.

Even though it ran, it didn't download anything because it seems the GET request found nothing.

It's skipping file downloads because of your archive. That's what the # … before a filename is supposed to mean.

EnchantedSIMCard commented 9 months ago

Thank you very much, I did not hear about adding square brackets to the strings before.

I would like to ask a question about the archive skipping downloads because I don't know how that works. If I want to download, what do I do with the archive then?

EnchantedSIMCard commented 9 months ago

Nevermind, I fixed it by deleting the ids thaty were created when I failed at the above problems. This issue is fixed, thank you for your help mikf.