mikf / gallery-dl

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

gallery-dl doesn't create individual zip files for individual posts when using user URL as argument #4758

Open matthewasage opened 8 months ago

matthewasage commented 8 months ago

I'm trying to make gallery-dl create individual (per post) zip archives for Pixiv/Kemono (but initially only Kemono as a test) posts that contain more than one file, and to keep single file IDs untouched in a user directory.

This is the config file I am using.

{
  "extractor":
  {
    "filename":
    {
        "count > 1 and count < 99": "{id}_{num:>02}.{extension}",
        "count >= 100": "{id}_{num:>03}.{extension}",
        "": "{id}.{extension}"
    },

    "kemonoparty":
    {
        "directory":
        {
            "count > 1" : ["{category}","{service}","{user}","{id}_{title[:240]}"],
            ""          : ["{category}","{service}","{user}"]
        },
        "postprocessors": ["zip"]
    }
},
"postprocessor":
{
    "zip":
    {
        "name": "zip",
        "compression": "store",
        "filter": "count > 1"
    }
 }
}

If I use gallery-dl with a specific post URL (for example: gallery-dl https://kemono.su/fanbox/user/3333333/post/6666666) with title "helloworld", it successfully creates a zip archive for that post, named as the parent folder with zip extension (66666666_helloworld.zip), within the directory kemonoparty/fanbox/3333333. This works perfectly.

However, if I instead invoke gallery-dl with a kemono fanbox user URL (for example: gallery-dl https://kemono.su/fanbox/user/3333333), it will take the parent folder name of the very first post ID it retrieves from the user page to use as the archive filename, and subsequent posts retrieved from that user will reuse the same archive from the instead of creating individual archives for each of them.

For example: If the user is 3333333 and the very first post retrieved from that user is id 6666666 with title "helloworld", it will create an initial zip file for the user named 6666666_helloworld.zip within the kemonoparty/fanbox/3333333 folder, with the contents of post 6666666; but then subsequently retrieved posts from the same user (as gallery-dl would continue downloading all user posts one by one after invoking it with the user URL) would end up stored within 6666666_helloworld.zip instead of creating new zip files for the subsequent posts.

Oh, also, removing the postprocessor and invoking with --zip will cause the same result.

The question is: Is there a way to make gallery-dl work the way I want? (single zip files for each count>1 posts when I invoke via user URL)

arshesney commented 1 month ago

The same happens with twitter extractor, any workarounds for this?