【发布时间】:2020-08-14 02:12:05
【问题描述】:
您好,我正在尝试使用 tweepy 抓取某个用户的推文。 这是我的代码:
tweets = []
username = 'example'
count = 140 #nb of tweets
try:
# Pulling individual tweets from query
for tweet in api.user_timeline(id=username, count=count, include_rts = False):
# Adding to list that contains all tweets
tweets.append((tweet.text))
except BaseException as e:
print('failed on_status,',str(e))
time.sleep(3)
我遇到的问题是推文返回时未完成,最后带有“...”。
我想我已经查看了堆栈溢出和其他地方的所有其他类似问题,但没有任何效果。大多数人都不关心我,因为我不处理转发。
我尝试将tweet_mode = 'extended' 和/或tweet.full_text 或tweet._json['extended_tweet']['full_text'] 放在不同的组合中。
我没有收到错误消息,但没有任何效果,只是一个空列表作为回报。 而且看起来文档已经过时了,因为它没有说明“tweet_mode”和“include_rts”参数:
有没有人设法获得每条推文的全文?我真的被这个看似简单的问题所困扰并且正在失去我的头发所以我会很感激任何建议:D 提前谢谢!!!
【问题讨论】:
标签: python string list twitter tweepy