A Mastodon bot that expands shortened URLs.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2.0 KiB



expandurl-mastodon - Mastodon bot that expands shortened URLs.




If you want the bot to expand an URL, reply to the post with the URL in it and mention the bot account.

This bot uses the same visibility as you, but posts unlisted instead of public. It retains the sensitive flag and spoiler warnings.

Some tracking parameters, like those beginning with utm_ are stripped. It also tries to rewrite AMP URLs to point at the real webpages.


If no config file is found, you will be asked to provide your account address and an access token is generated. The config file can be found in ${XDG_CONFIG_HOME}/expandurl-mastodon.json and looks like this:

    "account": "expandurl@example.social",
    "access_token": "abc123",
        "url": "socks5h://[::1]:1080/",
        "user": "user23",
        "password": "supersecure"
    "replace" :
            "//amp\\." : "//",
            "[\\?&]__twitter_impression=[^&]+" : "",
            "[\\?&]utm_[^&]+" : "",
            "[\\?&]wt_zmc=[^&]+" : "",
            "[\\?&]wtmc=[^&]+" : ""

If you want to use a proxy or define your own replacements, you have to edit the configuration file manually. After the configuration file is generated, you can start expandurl-mastodon as daemon.


  • Configuration file: ${XDG_CONFIG_HOME}/expandurl-mastodon.json

${XDG_CONFIG_HOME} is usually ~/.config.