mikf / gallery-dl

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

reddit - change output folder based on input URL #6454

Open docholllidae opened 6 days ago

docholllidae commented 6 days ago

my current config when scraping reddit outputs to directory reddit\{author}\

I'd like to break it up slightly so that it only outputs to that folder when the input URL is a user profile, and if the input url is otherwise a direct link to a submission/comments page - or a whole subreddit - the output directory should be reddit\{subreddit}\

here's my reddit config:

"directory": ["Reddit","{author}"],
"filename": "{date:%Y-%m-%d_%H-%M-%S}~_~{subreddit}~_~{id}-{num}.{author}~_~{title[0:27]}~_~{filename}.{extension}"
mikf commented 6 days ago

You can set different options per subcategory, user in this case. Subcategory values can be gotten with gallery-dl -E <URL>.

{
    "extractor": {
        "reddit": {
            "directory": ["Reddit","{subreddit}"],
            "filename": "{date:%Y-%m-%d_%H-%M-%S}~_~{subreddit}~_~{id}-{num}.{author}~_~{title[0:27]}~_~{filename}.{extension}",

            "user": {
                "directory": ["Reddit","{author}"]
            }
        }
    }
}