Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[mastodon] custom filename saves as "none" #6636

Open
rbbay opened this issue Dec 9, 2024 · 1 comment
Open

[mastodon] custom filename saves as "none" #6636

rbbay opened this issue Dec 9, 2024 · 1 comment

Comments

@rbbay
Copy link

rbbay commented Dec 9, 2024

hi I want to backup my mastodon account and am trying to set a more useful custom filename to download my likes/bookmarks. I would like it to be instance_username_date_(media id)_number.extension. I barely have any coding experience, so the documentation unfortunately isn't very helpful to me. I copied the default config file and frankenstein'ed some stuff I saw other people post. It is now like this:

"[instance]":
{
"root": "[instance]",
            "access-token": "[my access token]",
            "cards"       : false,
            "reblogs"     : false,
            "replies"     : true,
            "text-posts"  : false,

"postprocessors": [{
"name": "metadata",
"event": "post",
"filename" : "{instance}_{author[name]}_{date:%Y%m%d-%H%M%S}_{media[id]}_{num:?/ />02}.{extension}",
"format": "{content}\n"
}]
        },

So far my test files turn out like this
[instance]_110924171079948278_110924150688849789.jpg for images (the default file name)
[instance]_None_20231129-163556_None_.None for image descriptions

I would be eternally grateful if somebody could tell me how to fix this 🙏

@mikf
Copy link
Owner

mikf commented Dec 9, 2024

You can get a list of available metadata field names with -K:

  -K, --list-keywords         Print a list of available keywords and example
                              values for the given URLs
gallery-dl -K https://mastodon.social/@jk/103794036899778366

There is no media[...] or num during "event": "post". These values are only available for files.
User data for mastodon is available as {account[...]}, with {account[acct]} for the account name.


        {
            "access-token": "[my access token]",
            "cards"       : false,
            "reblogs"     : false,
            "replies"     : true,
            "text-posts"  : false,
            "filename"    : "{instance}_{account[acct]}_{date:%Y%m%d-%H%M%S}_{media[id]}_{num:>02}.{extension}",

            "postprocessors": [{
                "name": "metadata",
                "filter": "num == 1",
                "extension-format": "txt",
                "format": "{content}\n"
            }]
        }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants