douwei7501 2014-07-25 14:56
浏览 45
已采纳

Twitter API since_id和max_id

I'm trying to get and generate a Twitter timeline from PHP and Javascript. So I doing the following things.

1- Get an initial tweets for #OneHashtag, with this query params: count=20, since_id=0, max_id=NULL (no max_id param)

2- Set my since_id variable with the newest tweet previosly retrieved.

3- Set max_id variable with SINCE_ID + 20 (count parameter)

4- Make the query with this new params

My problem and question is, this approuch is correct? And second, i'm having problems to perform addition beetween SINCE_ID + 20 in javascript, to set my new params and make the ajax request.

Much appreciate your help! Regards.

  • 写回答

1条回答 默认 最新

  • drl37530 2014-07-28 20:11
    关注

    You don't want to add 20 to the ID; these IDs are huge, adding 20 to the ID won't give you what you need, and you will get problems if more than 20 tweets have been posted since your last update.

    See Working with Timelines for more information, including the problem with 'pages' (or, adding 20 in your example).

    It depends on which way you're going. If you want to load tweets older than your 20, you would set max_id to the ID of the oldest tweet you have. If you want to load tweets newer than your 20, you would set since_id to the ID of the newest tweet you have. Note that, as explained in those docs, when you use max_id, the tweet with that ID will be returned in the results again.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站
  • ¥50 成都蓉城足球俱乐部小程序抢票
  • ¥15 yolov7训练自己的数据集
  • ¥15 esp8266与51单片机连接问题(标签-单片机|关键词-串口)(相关搜索:51单片机|单片机|测试代码)
  • ¥15 电力市场出清matlab yalmip kkt 双层优化问题
  • ¥30 ros小车路径规划实现不了,如何解决?(操作系统-ubuntu)
  • ¥20 matlab yalmip kkt 双层优化问题
  • ¥15 如何在3D高斯飞溅的渲染的场景中获得一个可控的旋转物体
  • ¥88 实在没有想法,需要个思路
  • ¥15 MATLAB报错输入参数太多