mikf / gallery-dl

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

JSONDecodeError when loading "my_directory.conf" : Expecting property name enclosed in double quotes: line 18 column 9 (char 665) #5674

Closed jojo2833432 closed 3 weeks ago

jojo2833432 commented 3 weeks ago

Note I'm a script kiddy so I'm not 100% sure on how this program works exactly. But, I have my .conf file looking like this:

{
    "extractor":
    {
        "base-directory": "./",
        "deviantart":
        {
            "directory": ["[gallery-dl]", "[{category}] {author[username]}"],
            "filename": "[{category}] {author[username]}—{index}—{date:%Y.%m.%d}—{title}.{extension}",
            "client-id": "123",
            "client-secret": "123"
        },
        "twitter":
        {
            "#": "write text content for *all* tweets",
            "postprocessors": ["content"],
            "text-tweets": true,
            "filename": "[{category}] {author[name]}—{date:%Y.%m.%d}—{retweet_id|tweet_id}—{filename}.{extension}]",
        },
    }
}

and yet its complaining about: "Expecting property name enclosed in double quotes: line 18 column 9 (char 665)" in my command box.

mikf commented 3 weeks ago

There shouldn't be a comma , after the "filename" value on line 18 and there shouldn't be a comma , after the closing curly brace } for the "twitter" block in line 19 (}, -> }).

Also, the content post processor isn't defined anywhere. You need to add this next to the "extractor" block.

    "postprocessor":
    {
        "#": "write 'content' metadata into separate files",
        "content":
        {
            "name" : "metadata",

            "#": "write data for every post instead of each individual file",
            "event": "post",
            "filename": "{post_id|tweet_id|id}.txt",

            "#": "write only the values for 'content' or 'description'",
            "mode" : "custom",
            "format": "{content|description}\n"
        }
    }
jojo2833432 commented 3 weeks ago

wait so this is in the extractor block? or outside?

{
    "extractor":
    {
        "base-directory": "./",
        "deviantart":
        {
            "directory": ["[gallery-dl]", "[{category}] {author[username]}"],
            "filename": "[{category}] {author[username]}—{index}—{date:%Y.%m.%d}—{title}.{extension}",
            "client-id": "123",
            "client-secret": "12345"
        },
        "twitter":
        {

            "postprocessors":
            {
        "content":
        {
            "name" : "metadata",

            "#": "write data for every post instead of each individual file",
            "event": "post",
            "filename": "{post_id|tweet_id|id}.txt",

            "#": "write only the values for 'content' or 'description'",
            "mode" : "custom",
            "format": "{content|description}\n"
        }
    }
            "text-tweets": true,
            "filename": "[{category}] {author[name]}—{date:%Y.%m.%d}—{retweet_id|tweet_id}—{filename}.{extension}]",
        }
    }
}
Hrxn commented 3 weeks ago

"filename" belongs in the site-specific block which is inside of "extractor", always.

mikf commented 3 weeks ago

I apologize for not providing a copy-paste solution:

{
    "extractor":
    {
        "base-directory": "./",
        "deviantart":
        {
            "directory": ["[gallery-dl]", "[{category}] {author[username]}"],
            "filename": "[{category}] {author[username]}—{index}—{date:%Y.%m.%d}—{title}.{extension}",
            "client-id": "123",
            "client-secret": "123"
        },
        "twitter":
        {
            "#": "write text content for *all* tweets",
            "postprocessors": ["content"],
            "text-tweets": true,
            "filename": "[{category}] {author[name]}—{date:%Y.%m.%d}—{retweet_id|tweet_id}—{filename}.{extension}]"
        }
    },
    "postprocessor":
    {
        "content":
        {
            "name" : "metadata",
            "event": "post",
            "filename": "{post_id|tweet_id|id}.txt",
            "mode" : "custom",
            "format": "{content|description}\n"
        }
    }
}
jojo2833432 commented 3 weeks ago

works with no issue! thanks!