[英]How to revoke twitter API request after rate limit exceed?
我正在使用Twitter API 1.1,正在獲取用戶的推文。
我正在使用此代碼
<?php
$url = "https://api.twitter.com/1.1/statuses/user_timeline.json";
$requestMethod = "GET";
$cursor = isset($cursor) ? $cursor : "-1";
$getfield = "?cursor=" . $cursor . "&user_id=" . $user . "&count=10";
$twitter = new TwitterAPIExchange($settings);
$string = $twitter->setGetfield($getfield)
->buildOauth($url, $requestMethod)
->performRequest();
$tweets = json_decode($string, 1);
echo '<pre>';print_r($string);echo '</pre>';
?>
有一個方法可以在收到特定請求后接收since_id,以便我可以從上一個收到的ID開始為下一個請求重新排隊?
例如:在一個請求中,我要獲取0-1000條記錄,在下一個請求中,我要從第1001條記錄開始。
在twitter上可以嗎?
如果您在不使用since_id的情況下向時間軸發出請求,而您返回的最新tweet的ID為“ 123”,那么在間隔之后,您可以使用最新tweet ID“ 123”作為user_timeline的since_id值。 然后,您將獲得(最多200條)該用戶發布的第二條最新推文,因為他們發布了推文“ 123”。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.