开发者

Twitter API search user's tweets between dates

开发者 https://www.devze.com 2023-03-14 05:36 出处:网络
Is there a way to get tweets for a certain user between dates? I tried using Search API, but no success. The user\'s timeline api does not have date parameters.

Is there a way to get tweets for a certain user between dates? I tried using Search API, but no success. The user's timeline api does not have date parameters.

The only way that I found is get the 200 most recent tweets of the user and check by parsing date.

$.getJSON(
                'http://twitter.com/status/user_timeline/' + account_name + '.json?callback=?',
                function(data){
                    if (!data || data.length === 0)
                        return false;

                    var date = new Date(data[0].created_at);
                    //[Date comparison goes here]

                }
            );

I thi开发者_高级运维nk there is a better way to to this, but searching not helped at all.


The search API supports this, but you have to assemble your query like so:

http://search.twitter.com/search.json?q=+from%3Atwitterapi+since%3A2011-06-20+until%3A2011-06-20

The query string above is the urlencoded form of:

q= from:twitterapi since:2011-06-20 until:2011-06-20

The list of search operators can be found here.

0

精彩评论

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