为什么 Twitter API 返回错误的推文 ID? [英] Why a wrong tweet id is returned from twitter API?

查看:28
本文介绍了为什么 Twitter API 返回错误的推文 ID?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 Twitter API 来检索用户主页时间线推文.我使用 json 响应格式.最近推文 id(在 API 中它只是id")被重新调整了错误.举个例子

通常它应该像这样返回:id":14057503720,(示例来自推特控制台)但是根据我的要求,它返回如下:id":1172601832

少1位数,完全不同.我需要正确的 ID,因为我无法使用诸如 since_id 或 max_id 之类的参数.

解决方案

使用 id_str 而不是 id.它似乎没有记录,但是如果您查看 JSON 的原始来源,您可以看到每条推文的 id_str 是与推文 ID 正确对应的那个.>

I use twitter API to retrieve the user home timeline tweets. I use json response format. Recently the tweet id (in API it is just 'id') are retuned wrong. As an example

normally it should return like this: "id": 14057503720, (example is from twitter console) however at my request it is returned like this: "id": 1172601832

It is 1 digit less and it is totally different. I need the proper ID because I can't make use of the parameters like since_id or max_id.

解决方案

Use id_str instead of id. It doesn't seem to be documented, but if you look at the raw source of the JSON you can see that id_str for each tweet is the one that correctly corresponds to the ID of the tweet.

这篇关于为什么 Twitter API 返回错误的推文 ID?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆