1

我想检查某条推文是否是对我发送的推文的回复。以下是我认为我可以做到的方式:

Step1:发布推文并存储发布推文的ID

Step2:听我的句柄,收集所有有我的句柄的推文

Step3:tweet.in_reply_to_status_id用于查看tweet是否回复了存储的id

在这个逻辑中,我不确定如何获取我在步骤 1 中发布的推文的状态 ID。有没有办法可以得到它?如果没有,还有其他方法可以解决这个问题吗?

4

2 回答 2

0

可以做的是从用户那里获取最后一条推文,然后获取相关推文的 tweet.id。这可以这样做:

latestTweets = api.user_timeline(screen_name = 'user', count = n, include_rts = False)

但是,我怀疑这是最有效的方法。

于 2013-05-16T13:57:22.720 回答
-1

当您调用对象的update_status方法时tweepy.API,它会返回一个Status对象。此对象包含有关您的推文的所有信息。

例子:

my_tweet_ids = list()

api = tweepy.API(auth)

# Post to twitter
status = api.update_status(status='Testing out my Twitter')

# Append this tweet's id to my list of tweets
my_tweet_ids.append(status.id)

然后,您可以使用迭代列表for each tweet_id in my_tweet_ids并检查每个回复的数量。

于 2017-02-28T00:13:54.903 回答