-
-
Save emre/c3314a415171c91a53a68f6de575f128 to your computer and use it in GitHub Desktop.
Unfollow
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import time | |
from lightsteem.client import Client | |
from lightsteem.datastructures import Operation | |
def unfollow_accounts(username): | |
client = Client( | |
keys=["<posting_key>"]) | |
account = client.account(username) | |
accounts = set(account.following()).difference(set(account.followers())) | |
print(f"{len(accounts)} accounts found.") | |
for account in accounts: | |
follow_json = json.dumps( | |
["follow", { | |
"follower": username, | |
"following": account, | |
"what": [], | |
}] | |
) | |
unfollow_op = Operation('custom_json', { | |
'required_auths': [], | |
'required_posting_auths': [username, ], | |
'id': 'follow', | |
'json': follow_json, | |
}) | |
client.broadcast(unfollow_op) | |
print(f"Unfollowed {account}") | |
time.sleep(2) | |
if __name__ == '__main__': | |
unfollow_accounts('emrebeyler') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment