dongzhonggua4229 2011-06-24 10:44
浏览 61
已采纳

如何获取指定用户或给定主题标签的所有推文?

I'm trying to get a json/xml callback of all tweets for user 'zapallpeople' or containing hashtag '#zapallpeople'. I've tried the search api but it will only return tweets from the last 6 days. http://search.twitter.com/search.atom?q=from:zapallpeople%20OR%20%23zapallpeople

Then I've tried doing this with the Streaming API's tracking method using the Phirehose PHP library but this doesn't work on our webserver for some reason. (I get a PHP timeout error)

<?php
require_once('../lib/Phirehose.php');
/**
 * Example of using Phirehose to display a live filtered stream using track words 
 */
class FilterTrackConsumer extends Phirehose
{
  /**
   * Enqueue each status
   *
   * @param string $status
   */
  public function enqueueStatus($status)
  {
    /*
     * In this simple example, we will just display to STDOUT rather than enqueue.
     * NOTE: You should NOT be processing tweets at this point in a real application, instead they should be being
     *       enqueued and processed asyncronously from the collection process. 
     */
    $data = json_decode($status, true);
    if (is_array($data) && isset($data['user']['screen_name'])) {
      print $data['user']['screen_name'] . ': ' . urldecode($data['text']) . "
";
    }
  }
}

// Start streaming
$sc = new FilterTrackConsumer('username', 'password', Phirehose::METHOD_FILTER);
$sc->setTrack(array('zapallpeople'));
$sc->consume();

Are there any other methods to do this?

  • 写回答

1条回答 默认 最新

  • dongqing314511 2011-06-24 10:48
    关注

    I think there is no longer history available. See amongst other google hits this link. It might be an oldy, but the concept stands: there is no longer search history then a couple of days, not exactly specified by twitter as far as I know.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 乌班图ip地址配置及远程SSH
  • ¥15 怎么让点阵屏显示静态爱心,用keiluVision5写出让点阵屏显示静态爱心的代码,越快越好
  • ¥15 PSPICE制作一个加法器
  • ¥15 javaweb项目无法正常跳转
  • ¥15 VMBox虚拟机无法访问
  • ¥15 skd显示找不到头文件
  • ¥15 机器视觉中图片中长度与真实长度的关系
  • ¥15 fastreport table 怎么只让每页的最下面和最顶部有横线
  • ¥15 R语言卸载之后无法重装,显示电脑存在下载某些较大二进制文件行为,怎么办
  • ¥15 java 的protected权限 ,问题在注释里