如何使用机器人更改用户的 Twitter 名称?

How can I change a user's Twitter name with a bot?

我想知道是否有办法用软件更改您的 Twitter 名称。 我想做的是一个每天递减我名字中的数字的程序。

例如,10 月 3 日我的名字可能是 "Spam - 5",但 10 月 4 日可能是 "Spam - 4"。

最好用 Python 2.7.x

您可以使用 POST account/update_profile API 端点更新您的 Twitter 用户名。有关详细信息,请参阅 the relevant documentation

您需要创建一个与您的帐户关联的 Twitter Application 以获得所需的 OAuth 密钥。

使用python-twitter:

import time, twitter

api = twitter.Api(consumer_key='CONSUMER_KEY_HERE', consumer_secret='CONSUMER_SECRET_HERE', access_token_key='ACCESS_TOKEN_HERE', access_token_secret='ACCESS_TOKEN_SECRET_HERE')

i = 0
while True:
    api.UpdateProfile(name=str(i))
    i += 1
    time.sleep(60 * 60 * 24) # 1 day