【发布时间】:2015-04-15 02:29:55
【问题描述】:
我目前正在使用 twitter API(twit npm 包),我目前正在收到这样的结构的响应
{ metadata: [Object],
I20150213-22:24:29.155(0)? created_at: 'Fri Feb 13 22:24:07 +0000 2015',
I20150213-22:24:29.156(0)? id: 566362206468845600,
I20150213-22:24:29.156(0)? id_str: '566362206468845569',
I20150213-22:24:29.157(0)? text: 'Photo: New BTS picture from Mockingjay part http://t.co/fo30mcLRYV',
I20150213-22:24:29.158(0)? source: '<a href="http://www.tumblr.com/" rel="nofollow">Tumblr</a>',
I20150213-22:24:29.158(0)? truncated: false,
I20150213-22:24:29.159(0)? in_reply_to_status_id: null,
I20150213-22:24:29.159(0)? in_reply_to_status_id_str: null,
I20150213-22:24:29.160(0)? in_reply_to_user_id: null,
I20150213-22:24:29.160(0)? in_reply_to_user_id_str: null,
I20150213-22:24:29.161(0)? in_reply_to_screen_name: null,
I20150213-22:24:29.161(0)? user: [Object],
I20150213-22:24:29.162(0)? geo: null,
I20150213-22:24:29.162(0)? coordinates: null,
I20150213-22:24:29.163(0)? place: null,
I20150213-22:24:29.163(0)? contributors: null,
I20150213-22:24:29.164(0)? retweet_count: 0,
I20150213-22:24:29.288(0)? favorite_count: 0,
I20150213-22:24:29.289(0)? entities: [Object],
I20150213-22:24:29.289(0)? favorited: false,
I20150213-22:24:29.290(0)? retweeted: false,
I20150213-22:24:29.290(0)? possibly_sensitive: false,
I20150213-22:24:29.291(0)? lang: 'en' },
我正在尝试检索实体对象以访问其中的潜在媒体项,但是当我 console.log() 时,此数组 [object Object] 中的实体键被记录下来。如何访问对象的内部?我打算从这个对象内部提取一个图片 url,但我看不到里面有什么。根据 Twitter API 网站,媒体存储在实体对象中。
任何帮助将不胜感激。
【问题讨论】:
-
我想几乎所有的浏览器控制台都允许你点击
[object Object]这样的东西来查看它下面的实际属性结构......
标签: javascript json api object twitter