【问题标题】:Tweepy Status.text doesn't return full textTweepy Status.text 不返回全文
【发布时间】:2020-10-14 17:42:56
【问题描述】:

好的,我想获取@MZ_GOV_PL 的最新推文,现在是这条转推:

https://twitter.com/NFZ_Centrala/status/1316416216295182337

我想得到它的全文,所以我写了这段代码:

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 而不是我现在正在使用的解决它,但我不明白,它只是不起作用

【问题讨论】:

    标签: python twitter tweepy twitter-search


    【解决方案1】:

    好的,所以我想出了一个答案,一切都很简单。在它的自然状态下,它只返回 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)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-09-20
      • 2018-10-20
      • 2018-06-27
      • 2011-12-04
      • 2014-10-24
      • 2020-12-03
      • 2018-04-27
      • 1970-01-01
      相关资源
      最近更新 更多