Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/api/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Instagram API用于获取带有特定哈希标记的图片_Api_Tags_Instagram - Fatal编程技术网

Instagram API用于获取带有特定哈希标记的图片

Instagram API用于获取带有特定哈希标记的图片,api,tags,instagram,Api,Tags,Instagram,我想使用PHP从Instagram获取所有带有特定哈希标记的图片。我如何才能做到这一点?请看这里,以便开始: 然后,为了通过标签检索图片,请查看以下内容: 从Instagram获取标签不需要OAuth,因此您可以通过以下URL进行调用: 获取图像 https://api.instagram.com/v1/tags/{tag name}/media/recent?access_token={token} 搜索 https://api.instagram.com/v1/tags/search?q

我想使用PHP从Instagram获取所有带有特定哈希标记的图片。我如何才能做到这一点?

请看这里,以便开始:

然后,为了通过标签检索图片,请查看以下内容:

从Instagram获取标签不需要OAuth,因此您可以通过以下URL进行调用:

获取图像
https://api.instagram.com/v1/tags/{tag name}/media/recent?access_token={token}

搜索
https://api.instagram.com/v1/tags/search?q={tag query}&access_token={token}

标签信息

https://api.instagram.com/v1/tags/{tag name}?access_token={token}

首先,Instagram API端点“tags”需要OAuth身份验证

您可以使用以下url查询特定hashtag(在本例中为snowy)的结果

每小时的费率限制为5000(X-rate Limit-Limit:5000)

样本响应

{
  "pagination":  {
    "next_max_tag_id": "1370433362010",
    "deprecation_warning": "next_max_id and min_id are deprecated for this endpoint; use min_tag_id and max_tag_id instead",
    "next_max_id": "1370433362010",
    "next_min_id": "1370443976800",
    "min_tag_id": "1370443976800",
    "next_url": "https://api.instagram.com/v1/tags/snowy/media/recent?access_token=40480112.1fb234f.4866541998fd4656a2e2e2beaa5c4bb1&max_tag_id=1370433362010"
  },
  "meta":  {
    "code": 200
  },
  "data":  [
     {
      "attribution": null,
      "tags":  [
        "snowy"
      ],
      "type": "image",
      "location": null,
      "comments":  {
        "count": 0,
        "data":  []
      },
      "filter": null,
      "created_time": "1370418343",
      "link": "http://instagram.com/p/aK1yrGRi3l/",
      "likes":  {
        "count": 1,
        "data":  [
           {
            "username": "iri92lol",
            "profile_picture": "http://images.ak.instagram.com/profiles/profile_404174490_75sq_1370417509.jpg",
            "id": "404174490",
            "full_name": "Iri"
          }
        ]
      },
      "images":  {
        "low_resolution":  {
          "url": "http://distilleryimage1.s3.amazonaws.com/ecf272a2cdb311e2990322000a9f192c_6.jpg",
          "width": 306,
          "height": 306
        },
        "thumbnail":  {
          "url": "http://distilleryimage1.s3.amazonaws.com/ecf272a2cdb311e2990322000a9f192c_5.jpg",
          "width": 150,
          "height": 150
        },
        "standard_resolution":  {
          "url": "http://distilleryimage1.s3.amazonaws.com/ecf272a2cdb311e2990322000a9f192c_7.jpg",
          "width": 612,
          "height": 612
        }
      },
      "users_in_photo":  [],
      "caption":  {
        "created_time": "1370418353",
        "text": "#snowy",
        "from":  {
          "username": "iri92lol",
          "profile_picture": "http://images.ak.instagram.com/profiles/profile_404174490_75sq_1370417509.jpg",
          "id": "404174490",
          "full_name": "Iri"
        },
        "id": "471425773832908504"
      },
      "user_has_liked": false,
      "id": "471425689728724453_404174490",
      "user":  {
        "username": "iri92lol",
        "website": "",
        "profile_picture": "http://images.ak.instagram.com/profiles/profile_404174490_75sq_1370417509.jpg",
        "full_name": "Iri",
        "bio": "",
        "id": "404174490"
      }
    }
}
你可以在这里玩:

您需要将“身份验证”用作OAuth 2,系统将提示您通过Instagram登录。 张贴您可能必须在“模板”部分重新输入“标记名”


所有与分页相关的数据都可以在响应的“pagination”参数中找到,并使用它的“next_url”查询下一组结果。

目前还无法使用多个标记搜索内容,因为现在只支持单个标记


首先,Instagram API端点“标记”需要OAuth身份验证

这并不完全正确,您只需要一个API密钥。只是一个应用程序,并将其添加到您的请求中。 例如:

还要注意,用户名不是用户id。您可以查找用户id


搜索多个关键字的解决方法是,为每个标记启动一个请求,并在服务器上比较结果。当然,这可能会降低你的网站速度,这取决于你想比较多少关键词。

如何获取下一页url?我的意思是用php或javascript获取下一组响应?在响应中使用“next_url”查询进一步的结果。您可以在“分页”部分阅读更多内容。该端点现在似乎已被弃用。我收到的具体回复是:{“meta”:{“code”:400,“error_type”:“apinotalowederror”,“error_message”:“此端点已失效”}}@jaspalingh apigee的链接不再工作
https://api.instagram.com/v1/users/userIdYouWantToGetMediaFrom/media/recent?client_id=yourAPIKey