我做了推特推特转发,跟随和取消关注人(当达到最大时),但当我认为我的机器人完全可操作Twitter阻止了我..这是因为如果wansn'检查我的机器人是否已经转发了一条推文,但是我有一个try/except块。所以我正在进行大量的API调用转发......我想知道如何检查我是否已经转发了此推文? 我想查找每个用户都转推推文,如果我的用户名在里面,传递到下一个推文,但它不是很有效。我可以分享我的代码,并随时要求澄清。 谢谢, Kajpio PS:我正在使用tweepy与API交互!Python脚本,推特推特转发特定推文
更新,这里是我的代码的一部分,只是部分检查转推:
loginToTwitter()
query = 'a string'
tweet_cursor= tweepy.Cursor(api.search, query, result_type="recent").items()
print("Searching")
for tweet in tweet_cursor:
tweetText = tweet.text.lower()
if "rt" in tweetText:
if tweet.retweeted == True: #It return me each time a false boolean but then I get the api.code 327 from twitter
print("already retweeted")
continue
try:
api.retweet(tweet.id)
print('Retweedted')
time.sleep(2)
except tweepy.TweepError as e:
if e.api_code == 327:
print("Tried but tweet already Retweeted")
print(e)
time.sleep(0.5)
continue
“我可以分享我的代码”请执行 –
如果您使用的是REST API,那么是的,您将会调用大量转推。为什么不看流媒体API(tweepy也可以处理)? – asongtoruin
最新的状态! Aleks Andreev –