【问题标题】:home_timeline missing tweets - API 1.1home_timeline 缺少推文 - API 1.1
【发布时间】:2013-06-21 18:15:02
【问题描述】:

我使用以下代码尝试从我的 home_timeline 抓取推文

    $tmhOAuth = new tmhOAuth(array('consumer_key'    => TW_KEY,
                   'consumer_secret' => TW_SECRET,
                      'user_token'      => TW_UTOKEN,
                      'user_secret'     => TW_USECRET,
                       ));
    $code = $tmhOAuth->request('GET', $tmhOAuth->url('1.1/statuses/home_timeline', 'json'));

$tmhOAuth 来自这里的这个库:https://github.com/themattharris/tmhOAuth

由于某种原因,只显示了一条推文,这是我最近的一条。我所有的旧推文都不可见。当我将秘密和密钥更改为另一个用户应用程序的秘密和密钥时,我遇到了类似的问题,一些推文是可见的,而另一些则不是。有谁知道为什么它不只是抓取所有 X 条最近的推文?为什么有些推文不见了?

【问题讨论】:

  • 在您的previous question 之外,您是否尝试过我建议的库?尝试其他库,然后,如果您仍然从 API 中获得相同的结果,您就知道这是 Twitter 方面的问题。

标签: twitter


【解决方案1】:

我下载了Jimbo's API from github,然后做了下面的代码

<?php
ini_set('display_errors', 1);
require_once('twjimbo/TwitterAPIExchange.php');

/** Set access tokens here - see: https://dev.twitter.com/apps/ **/
$settings = array(
    'oauth_access_token' => "",
    'oauth_access_token_secret' => "",
    'consumer_key' => '',
    'consumer_secret' => ""
);

]
$url = 'https://api.twitter.com/1.1/statuses/home_timeline.json';
$getfield = '?screen_name=anythingworkshere';
$requestMethod = 'GET';
$twitter = new TwitterAPIExchange($settings);
$json = $twitter->setGetfield($getfield)
             ->buildOauth($url, $requestMethod)
             ->performRequest();

echo '<pre>'; print_r(json_decode($json)); echo '</pre>';

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-05-30
    • 1970-01-01
    • 2020-09-09
    • 2013-08-19
    • 2012-12-05
    • 1970-01-01
    • 2023-03-10
    • 2017-12-26
    相关资源
    最近更新 更多