clean.py 1.0 KB

1234567891011121314151617181920212223242526272829303132333435
  1. from mastodon import Mastodon
  2. from config import *
  3. """
  4. following: account_unfollow
  5. followers: account_remove_from_followers
  6. lists: list_accounts_delete
  7. blocks: account_unblock
  8. mutes: account_unmute
  9. """
  10. def clean_accounts(mastodon, operations):
  11. for acc in operations.get("following", []):
  12. mastodon.account_unfollow(acc)
  13. for acc in operations.get("followers", []):
  14. mastodon.account_remove_from_followers(acc)
  15. for id, members in operations.get("lists_members", {}).items():
  16. mastodon.list_accounts_delete(id, members)
  17. for acc in operations.get("blocks", []):
  18. mastodon.account_unblock(acc)
  19. for acc in operations.get("mutes", []):
  20. mastodon.account_unmute(acc)
  21. if __name__ == "__main__":
  22. import json
  23. with open("operations.json", "r") as f:
  24. operations = json.load(f)
  25. mastodon = Mastodon(
  26. access_token=ACCESS_TOKEN, api_base_url=API_BASE_URL, ratelimit_method="pace"
  27. )
  28. #! are you sure? confirm again
  29. # clean_accounts(mastodon, operations)