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 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测