【问题标题】:How can I retrieve the full text of a tweet?如何检索推文的全文?
【发布时间】:2018-05-05 01:51:50
【问题描述】:

我运行下面的代码,即使我设置为参数tweet_mode='extended',我也没有得到检索到的推文的全文。有人可以帮我解决吗?

import tweepy

consumer_key ='xxxx'
consumer_secret = 'xxxx'

access_token = 'xxxx'
access_token_secret = 'xxxx'

# create our authentication variable
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token,access_token_secret)

api = tweepy.API(auth)

cursor= tweepy.Cursor(api.search,q="obama",tweet_mode='extended', lang="en", date='2017-11-13', days_ago=9).items(5)

for tweet in cursor:
    print (tweet.created_at,tweet.full_text)

这是对应的结果。

2017-11-21 13:55:20 Another one of Obama's poor little underprivileged Black ladies, oppressed by Whites? 
2017-11-21 13:55:20 RT @PoliticalShort: Remember when it was considered immoral to question whether Obama’s 20-year patronage at Wright’s radical church could…
2017-11-21 13:55:20 RT @IosrscIub: i had a dream that i was trying to find a fruit scale in walmart to weigh my pomegranates and then obama stopped me, took th…
2017-11-21 13:55:19 @WhereIs_Billy @FoxNews No Ure wrong! He saved them from possible yrs in jail there Dumb Ass! Look Wht happened to Otto cause Racist OBAMA did NOTHING! Mayb all u liberals shld go to N K good bye!  No F...... Respect! MAGA MAGA
2017-11-21 13:55:19 RT @oldhippiebroad: This is no judge. He’s politician all the way. He’s a disgrace. #UraniumOneScandal #LockThemAllUp  

【问题讨论】:

    标签: python python-3.x twitter tweepy python-twitter


    【解决方案1】:

    Twitter 不提供转推 (RT) 的全文。

    看起来第 1 条和第 4 条消息已完成,其他在时间戳后带有 RT 的消息已被 Twitter 截断,末尾带有“...”。

    最后一条 RT 消息足够短,不会被截断。

    【讨论】:

      猜你喜欢
      • 2019-03-06
      • 1970-01-01
      • 2016-10-10
      • 1970-01-01
      • 2015-03-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-08-19
      相关资源
      最近更新 更多