【问题标题】:Tweepy getting full tweet textTweepy 获取完整的推文文本
【发布时间】:2017-03-29 18:03:23
【问题描述】:

我正在使用以下代码使用 Tweepy API 检索推文:

    try:
        text="retweeted: "+json_reply['retweeted_status']['text']
        user_name ="retweeted: "+json_reply['retweeted_status']['user']['screen_name']
    except:
        text=json_reply['text']
        user_name=json_reply['user']['screen_name']

我收到以下与我的期望不符的输出推文。

1) 转推:M67 |巨蟹座中的疏散星团银河系中最古老的星团之一,由于它的邻居 M 经常被忽视... [url here]

2) 今天你的生活中可能会有一系列的活动,即使...更多癌症 [url here]

我的期望是这两个都不应该包含省略号。我在这里做错了什么?

【问题讨论】:

    标签: twitter text


    【解决方案1】:

    现在 Twitter API 中有一个扩展模式来处理这种情况。

    例如,使用 tweepy (Python),您可以使用 tweet_mode='extended' 获取全文(未在 Tweepy 文档中记录)。例如:

    print api.get_status('862328512405004288')._json['text']
    

    @tousuncotefoot @equipedefrance @CreditAgricole @AntoGriezmann @KMbappe @layvinkurzawa @UmtitiSam J'ai jamais vue d…https://tco/kALZ2ki9Vc

    print api.get_status('862328512405004288', tweet_mode='extended')._json['full_text']
    

    @tousuncotefoot @equipedefrance @CreditAgricole @AntoGriezmann @KMbappe @layvinkurzawa @UmtitiSam J'ai jamais vue de match de foot et cela ferait un beau cadeau pour mon copain !! ????????

    【讨论】:

      猜你喜欢
      • 2017-07-31
      • 2020-10-09
      • 2022-08-11
      • 2020-10-05
      • 1970-01-01
      • 2020-12-26
      • 2020-09-07
      • 2017-08-20
      • 2016-10-20
      相关资源
      最近更新 更多