diff --git a/README.md b/README.md index 99031bc..197702b 100644 --- a/README.md +++ b/README.md @@ -18,3 +18,4 @@ Within Python Virtual Environment: 3. Use your favourite scheduling method to set `python followers.py` to run and desired pace. 2.4.23 - New feature! post of unfollowing accounts +2.5.23 - New feature! unfollow unfollowing accounts diff --git a/followers.py b/followers.py index 709bdea..a325410 100644 --- a/followers.py +++ b/followers.py @@ -88,13 +88,29 @@ if __name__ == '__main__': post_text = f"@{mastodon.me().acct}\nseguidors: {len(followers)}\n" - post_text += f"locals: {local_followers} ({local_incr})\nremots: {remote_followers} ({remote_incr})" + post_text += f"locals: {local_followers} ({local_incr})\nremots: {remote_followers} ({remote_incr})\n" if unfollowers != None: + post_text += f'\nJa no et segueix:\n' + for unfollow in unfollowers: - post_text += f'\nJa no et segueix:\n@{unfollow}' + post_text += f'- {unfollow}' + + unfollow_id = mastodon.account_lookup(unfollow).id + + try: + + mastodon.account_unfollow(unfollow_id) + + post_text += f' (has deixat de seguir-lo)\n' + + except: + + post_text += f' (ja no existeix)\n' + + pass mastodon.status_post(post_text, in_reply_to_id=None, visibility='direct')