【问题标题】:How to get all Tweets for a specified user OR a given hashtag?如何获取指定用户或给定主题标签的所有推文?
【发布时间】:2011-06-24 10:44:41
【问题描述】:

我正在尝试获取用户“zapallpeople”或包含标签“#zapallpeople”的所有推文的 json/xml 回调。 我已经尝试过搜索 api,但它只会返回过去 6 天的推文。 http://search.twitter.com/search.atom?q=from:zapallpeople%20OR%20%23zapallpeople

然后我尝试使用 Phirehose PHP 库通过 Streaming API 的跟踪方法执行此操作,但由于某种原因这在我们的网络服务器上不起作用。 (我收到一个 PHP 超时错误)

<?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']) . "\n";
    }
  }
}

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

还有其他方法可以做到这一点吗?

【问题讨论】:

    标签: php xml json twitter


    【解决方案1】:

    我认为不再有可用的历史记录。在其他谷歌点击中查看this link。这可能是老生常谈了,但这个概念仍然存在:几天后不再有搜索历史,据我所知,Twitter 并没有完全指定。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-06-07
      • 1970-01-01
      • 2017-01-05
      • 1970-01-01
      • 2013-09-24
      • 2012-11-09
      相关资源
      最近更新 更多