mastodon-archive
mastodon-archive copied to clipboard
Delete media from mentions
I downloaded my archive with my toots + mentions. Then I downloaded the media. The issue is that the media archive contains the media from the mentions. I would like to get rid of them.
Is it possible to add an option to download/remove the media from the mentions ?
Not with the tool itself, unfortunately.
I'd say such a feature would have to be added to the file media.py
, in other words, some option for the media
command.
Ok, so as well as #40 that's something I should try to add, I guess ? :)
Maybe? 😄
Actually, if you're comfortable with the command line, you could get the URLs of the url
and the preview_url
attributes of all the media in mentions (I think! Lightly tested…) by using this jq command:
jq '.mentions[].media_attachments[]|.url,.preview_url' octodon.social.user.kensanata.json
With a little sed
you can extract all the path's you need:
jq '.mentions[].media_attachments[]|.url,.preview_url' octodon.social.user.kensanata.json \
| sed -n -e 's/[^\/]*\/\/[^\/]*\/\([^"]*\)"$/\1/p'
So perhaps this is enough to wrap around a loop to rm
? Something like the following, untested?
rm $(jq '.mentions[].media_attachments[]|.url,.preview_url' octodon.social.user.kensanata.json \
| sed -n -e 's/[^\/]*\/\/[^\/]*\/\([^"]*\)"$/\1/p')
Well, it's not that I don't want to do it, but I don't have the time right know but those media files takes some storage space :sweat_smile:
So thanks a lot for your command, I'll investigate. And maybe add some PR :)
(the best would be not to download them, with an option)
Yeah, to be honest I never download media...