[英]Tweepy user id from mention
我正在使用tweepy
設置一個腳本,找到最新提到的用戶名。 從這里,我想檢索推文的文本,以及他們的推特用戶名。 但是,我似乎無法檢索實際的@用戶名,只能檢索他們的ID號。 有什么建議么?
以下是我的代碼。 問號是我需要正確語法的地方:
myMentions = tweepy.Cursor (api.mentions).items(1)
for mention in myMentions:
statusText = mention.text
statusUser = mention.????
非常感謝!
這是最新的tweepy
版本對我tweepy
:
import tweepy
auth = tweepy.OAuthHandler(<consumer_key>, <consumer_secret>)
auth.set_access_token(<key>, <secret>)
api = tweepy.API(auth)
mentions = api.mentions_timeline(count=1)
for mention in mentions:
print mention.text
print mention.user.screen_name
希望有所幫助。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.