【问题标题】:Fetching maximum tweets from twitter using Twython使用 Twython 从 twitter 获取最大推文
【发布时间】:2014-01-11 04:21:38
【问题描述】:

我是 Twython 的新手,通过这个库我正在检索推文,但只有 10-15 条推文被获取。

我用来检索推文的代码 sn-p 如下所示:

user_timeline=twitter.getUserTimeline(screen_name="dksbhj")
for tweet in user_timeline:
    print tweet['text']

什么可以用来将推文数量从 10 条增加到 15 条?

【问题讨论】:

    标签: python twitter social-networking twython


    【解决方案1】:

    您应该将count 参数添加到您的请求中:

    user_timeline=twitter.getUserTimeline(screen_name="dksbhj", count=50)
    for tweet in user_timeline:
        print tweet['text'] + "\n"
    

    注意count 每个请求不能大于 200。
    如果您也想检索转发,请将参数 include_rts=1 添加到您的请求中:

    user_timeline=twitter.getUserTimeline(screen_name="dksbhj", count=50, include_rts=1)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-10-06
      • 2014-02-13
      • 2016-04-14
      • 2013-02-02
      • 2014-06-28
      相关资源
      最近更新 更多