Mastodon media and toot backup

Saves your Mastodon uploads to the filesystem, and also archives your toots to a HTML file. Change the atom feed URL and file destinations to your liking.

Requires node-red-feedparser to be installed to read the Atom feed.

[{"id":"75f5675e.f8a9f8","type":"feedparse","z":"91385b4b.ecf918","name":"Octodon toots & retoots","url":"https://octodon.social/users/fenwick67.atom","interval":15,"x":136,"y":272,"wires":[["fe97af7.0a9455","ed7602be.3f29a","fb4b55a3.016cb8"]]},{"id":"8157bc8.662284","type":"http request","z":"91385b4b.ecf918","name":"fetch media","method":"GET","ret":"bin","url":"","tls":"","x":631,"y":300,"wires":[["cb9baf9a.aaad5"]]},{"id":"fe97af7.0a9455","type":"function","z":"91385b4b.ecf918","name":"for each media url and filename","func":"/*\n get the media's name and url\n*/\n\nmsg.article.enclosures.map(function(e){\n    return e.url;\n}).filter(function(u){\n    return !!u\n}).forEach(function(u){\n    node.send({\n        url:u,\n        filename:'~/mastodon_backup/media/'+u.split('/').slice(-1)[0]\n    });\n})","outputs":1,"noerr":0,"x":425,"y":256,"wires":[["8157bc8.662284"]]},{"id":"cb9baf9a.aaad5","type":"file","z":"91385b4b.ecf918","name":"media file","filename":"","appendNewline":false,"createDir":true,"overwriteFile":"true","x":785,"y":360,"wires":[]},{"id":"ed7602be.3f29a","type":"debug","z":"91385b4b.ecf918","name":"","active":true,"console":"false","complete":"true","x":343,"y":132,"wires":[]},{"id":"fb4b55a3.016cb8","type":"file","z":"91385b4b.ecf918","name":"save toot","filename":"~/mastodon_backup/toots.html","appendNewline":true,"createDir":true,"overwriteFile":"false","x":280,"y":380,"wires":[]}]

Flow Info

Created 7 years, 7 months ago
Rating: not yet rated

Owner

Actions

Rate:

Node Types

Core
  • debug (x1)
  • file (x2)
  • function (x1)
  • http request (x1)
Other

Tags

  • mastodon
  • atom
  • backup
  • toot
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option