Tweepy Status.text 没有 return 全文
Tweepy Status.text doesn't return full text
好的,我想获取@MZ_GOV_PL的最新推文,此时转推:
而且我想得到它的全文,所以我写了这段代码:
def get_Latest_Tweet():
consumer_key = ""
consumer_secret = ""
access_token = ""
access_token_secret = ""
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
api = tweepy.API(auth)
statuses = api.user_timeline(id=462886126)
print(statuses[0].text)
这是完整的代码,在其他地方我刚开始使用它
我尝试使用 status.full_text 而不是我现在正在使用的方法来解决它,但我不明白,它根本不起作用
好的,所以我想出了一个答案,一切都很简单。在它的自然状态下它 returns 只有 140 个字符,所以而不是
statuses = api.user_timeline(id=462886126)
print(statuses[0].text)
我只需要:
statuses = api.user_timeline(id=462886126, tweet_mode='extended')
print(statuses[2].full_text)
好的,我想获取@MZ_GOV_PL的最新推文,此时转推:
而且我想得到它的全文,所以我写了这段代码:
def get_Latest_Tweet():
consumer_key = ""
consumer_secret = ""
access_token = ""
access_token_secret = ""
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
api = tweepy.API(auth)
statuses = api.user_timeline(id=462886126)
print(statuses[0].text)
这是完整的代码,在其他地方我刚开始使用它 我尝试使用 status.full_text 而不是我现在正在使用的方法来解决它,但我不明白,它根本不起作用
好的,所以我想出了一个答案,一切都很简单。在它的自然状态下它 returns 只有 140 个字符,所以而不是
statuses = api.user_timeline(id=462886126)
print(statuses[0].text)
我只需要:
statuses = api.user_timeline(id=462886126, tweet_mode='extended')
print(statuses[2].full_text)