如何获取“id”来自 Instagram api 的参数?

发布于 2024-12-26 04:41:53 字数 332 浏览 3 评论 0原文

有人可以告诉我“如何获取”或“什么是”ruby instagram api 方法中使用的“id”参数 location(id)、location_recent_media(id,options{})、media_item(id)、 media_likes(id) 等在院子文档中给出 http://rubydoc.info/github/Instagram/instagram-ruby-gem ?我使用的是 Rails,API 是使用 gem 安装的。

Can someone tell me "how to get" or "what is" the 'id' parameter that is used in the ruby instagram api methods location(id), location_recent_media(id,options{}), media_item(id), media_likes(id) etc given in the yard documentation http://rubydoc.info/github/Instagram/instagram-ruby-gem ? I am using rails and the api is installed using gem.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

我爱人 2025-01-02 04:41:53

您可以在此处查看如何使用 API 的示例 https://github.com/Instagram/ instagram-ruby-gem,看一下代码,我会说 id 取决于您正在查询的内容,如果您使用 location(id) ,它将是该位置的 id。 id,我相信您可以使用 location_search(longitude, latitude) ,这将为您提供一个包含所有靠近该坐标的位置的数组,例如(来自代码文档):

Instagram.location_search("37.7808851", "-122.3948632")

现在,要从“现实世界”位置获取该 会给你一个数组,位置在 37.7808851, -122.3948632 (164 S Park, SF, CA USA) 附近。

然后您可以将 id 数组与 location(id) 一起使用,例如:

mylocations = Instagram.location_search("37.7808851", "-122.3948632")
Instagram.location(mylocations.first)

希望有帮助。

You can see an example of how to use the API in here https://github.com/Instagram/instagram-ruby-gem, taking a look at the code I would say that the id is dependent on what you are querying, if you are using location(id) it would be the id of the location. Now, to get from a "real world" location to that id I believe you can use location_search(longitude, latitude) and that would give you an array with all the locations close to that coordinates, e.g (from the code documentation):

Instagram.location_search("37.7808851", "-122.3948632")

That would give you an array with the locations around 37.7808851, -122.3948632 (164 S Park, SF, CA USA).

Then you can use that array of ids with location(id), e.g:

mylocations = Instagram.location_search("37.7808851", "-122.3948632")
Instagram.location(mylocations.first)

Hope it helps.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文