mikf / gallery-dl

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

[postprocessors] how to write input url to file #5745

Closed maplestory03 closed 6 days ago

maplestory03 commented 1 week ago

How to write input url(If there is a auto conversion, use the converted download url) as output postprocessors to a file

     "postprocessors":
            [
            {
            "name": "metadata",
            "event": "post",
            "filename": "00_{category}_{user}_{subcategory}.url",
            "mode": "custom",
            "content-format":  ["[InternetShortcut]\nURL={inputurl}"]
              }
              ]

could it be possible?

mikf commented 1 week ago

The input URL, i.e. the URL gallery-dl is ran with, can be accessed by enabling metadata-extractor and using its url attribute.

"metadata-extractor": "extr_",

"postprocessors":
[
    {
    ...
    "content-format":  ["[InternetShortcut]", "URL={extr_.url}"]
    }
]

I'd recommend using "event": "init", since the input URL doesn't change per post.