栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

如何通过API查询搜索Instagram?

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

如何通过API查询搜索Instagram?

首先,如果您不知道,那么已经有一个类似的(至少)Web应用程序。话虽这么说,让我们去回答:

您需要获取client_id,因为您需要它来调用API(此处提供更多信息)。你应该打电话到该端点(约Instagram的的API端点更多信息这里,你应该阅读:P):

https://api.instagram.com/v1/tags/SEARCH-TAG/media/recent?client_id=CLIENT-ID&callback=YOUR-CALLBACK

当然,请

SEARCH-TAG
使用用户输入,
CLIENT-ID
之前输入的内容以及
YOUR-CALLBACK
回调函数的名称来更改。

此调用的响应来自JSONP,看起来像这样(摘自API页面):

{    "data": [{        "type": "image",        "filter": "Earlybird",        "tags": ["snow"],        "comments": { "data": [{     "created_time": "1296703540",     "text": "Snow",     "from": {         "username": "emohatch",         "username": "Dave",         "id": "1242695"     },     "id": "26589964" }, {     "created_time": "1296707889",     "text": "#snow",     "from": {         "username": "emohatch",         "username": "Emo Hatch",         "id": "1242695"     },     "id": "26609649" }], "count": 3        }        "caption": { "created_time": "1296703540", "text": "#Snow", "from": {     "username": "emohatch",     "id": "1242695" }, "id": "26589964"        },        "likes": { "count": 1, "data": [{     "username": "mikeyk",     "full_name": "Mike Krieger",     "id": "4",     "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1242695_75sq_1293915800.jpg" }]        },     "link": "http://instagr.am/p/BWl6P/",        "user": { "username": "emohatch", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1242695_75sq_1293915800.jpg", "id": "1242695", "full_name": "Dave"        },        "created_time": "1296703536",        "images": { "low_resolution": {     "url": "http://distillery.s3.amazonaws.com/media/2011/02/02/f9443f3443484c40b4792fa7c76214d5_6.jpg",     "width": 306,     "height": 306 }, "thumbnail": {     "url": "http://distillery.s3.amazonaws.com/media/2011/02/02/f9443f3443484c40b4792fa7c76214d5_5.jpg",     "width": 150,     "height": 150 }, "standard_resolution": {     "url": "http://distillery.s3.amazonaws.com/media/2011/02/02/f9443f3443484c40b4792fa7c76214d5_7.jpg",     "width": 612,     "height": 612 }        },        "id": "22699663",        "location": null    },    ...    ]}

然后,您只需要处理此响应并对其进行任何操作即可:)



转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/399768.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号