开发者

Twitter search API refresh_url is undefined

开发者 https://www.devze.com 2023-02-14 01:19 出处:网络
I am making a GET request to twitter to receive a JSONP object back of most recent posts of a specific tag. Once I receive the data I loop through 开发者_运维问答the results array getting each tweet i

I am making a GET request to twitter to receive a JSONP object back of most recent posts of a specific tag. Once I receive the data I loop through 开发者_运维问答the results array getting each tweet individually.

My problem I am having is that console.log(data.results[i].refresh_url); is giving me an undefined value. So my question is:

  1. Do you receive a refresh_url variable on all searches?
  2. If not, how is refresh_url used? I would have to find the latest post id in the loop and re-query using since_id= which defeats the purpose of using refresh_url.
$.getJSON("http://search.twitter.com/search.json?&callback=?&q=css", function(data) {
    for(var i in data.results)
    {
         console.log(data.results[i].refresh_url);
    }           
});

Thanks.


You're looking for refresh_url in the wrong place. It's outside of the result set.

Replace your logging line with

console.log(data.refresh_url);

This will give you to the URL to refresh from.

0

精彩评论

暂无评论...
验证码 换一张
取 消