The more followers you have, the harder it is to do this manually. It's a waste of time ... So I decided to make it semi-automated. In addition, since the number of followers has not reached 10,000 yet, I would like to manually perform the unfollowing work while actually visually observing the target account. Script up to get the account list.
Omitted
$ pip install tweepy
From https://developer.twitter.com/en/portal/dashboard.
#unfollow_list.py
import tweepy
keys = dict(
screen_name = '[Twitter account name (screen_name)]',
consumer_key = '[Consumer key]',
consumer_secret = '[Consumer secret]',
access_token = '[Access token]',
access_token_secret = '[Access token secret]',
)
SCREEN_NAME = keys['screen_name']
CONSUMER_KEY = keys['consumer_key']
CONSUMER_SECRET = keys['consumer_secret']
ACCESS_TOKEN = keys['access_token']
ACCESS_TOKEN_SECRET = keys['access_token_secret']
auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)
auth.set_access_token(ACCESS_TOKEN, ACCESS_TOKEN_SECRET)
api = tweepy.API(auth)
followers = api.followers_ids(SCREEN_NAME)
friends = api.friends_ids(SCREEN_NAME)
for f in friends:
if f not in followers:
print(api.get_user(f).screen_name)
$ python unfollow_list.py
If you want to put it in a file, copy it.
If you want the program to automatically remove it, add the api.destroy_friendship (f)
statement after the print (api.get_user (f) .screen_name)
.
Recommended Posts