我想要使用PHP獲取來自Instagram的具體哈希標記的所有圖片。我怎樣才能做到這一點?用API獲取具有特定井號標籤的圖片
回答
看看這裏,以便開始: http://instagram.com/developer/
,然後才能按標籤檢索圖片,看看這裏: http://instagram.com/developer/endpoints/tags/
從Instagram的獲取標籤不需要OAuth的,所以您可以通過以下網址進行電話:
GET IMAGES
https://api.instagram.com/v1/tags/{tag-name}/media/recent?access_token={TOKEN}
SEARCH
https://api.instagram.com/v1/tags/search?q={tag-query}&access_token={TOKEN}
TAG INFO
https://api.instagram.com/v1/tags/{tag-name}?access_token={TOKEN}
首先,Instagram的API端點 「標籤」 需要OAuth認證。
可以使用以下網址
查詢(在這種情況下大雪)的特定主題標籤的結果是速率限制到5000(X-Ratelimit限:5000)每小時
https://api.instagram.com/v1/tags/snowy/media/recent
樣本響應
{
"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密鑰。只需register一個應用程序,並將其添加到您的請求。 實施例:
https://api.instagram.com/v1/users/userIdYouWantToGetMediaFrom/media/recent?client_id=yourAPIKey
還要注意,用戶名不是用戶ID。您可以查找用戶ID的here.
如果您爲每個標記啓動一個請求並在服務器上比較結果,則搜索多個關鍵字的解決方法就是如果您想要搜索多個關鍵字,當然,這可能會減慢你的網站,取決於你想要比較多少關鍵字。
- 1. 如何使用特定的井號標籤獲取特定位置的推文
- 2. 有井號標籤
- 3. 如何從Instagram獲取具有特殊標籤的圖片?
- 4. 獲取推特具有特定#標籤的用戶
- 5. 從Instagram獲取所有的照片,其中有一個與PHP的具體井號標籤
- 6. 根據magento中的標籤獲取特定產品圖片
- 7. 獲取具有特定標籤的元素jQuery
- 8. 使用jquery獲取具有特定屬性的標籤的工具提示
- 9. 獲取特定HTML標籤
- 10. 如何從具有特定類名的特定標籤獲取文本值?
- 11. Regex.Replace井號標籤,但忽略撇號(
- 12. 如何使用Flickr的getRecent API方法獲取具有特定標籤的圖像?
- 13. Instagram寶石:使用特定#標籤獲取照片
- 14. 使用谷歌自定義搜索API獲取圖片的標籤
- 15. VB6:獲取標籤控件的圖片?
- 16. 獲取具有特定ID
- 17. Github API只能得到具有特定標籤的請求
- 18. 讓所有的井號標籤從用戶
- 19. 所有文字匹配的作用而不是井號標籤
- 20. 如何獲取特定的HTML標籤
- 21. 用圖api獲取照片
- 22. 追加井號標籤在角2
- 23. 在android ediitext內創建井號標籤
- 24. 獲取特定目標的版本號
- 25. 選擇爲獲得所有標籤具有特定屬性和
- 26. 使用Scribe獲取帶有特定主題標籤的推文
- 27. 設計標籤,排除具有特定樣式的標籤
- 28. Facebook圖形API從同一用戶獲取特定用戶的圖片
- 29. MySQL的搜索具有和不具有特定的標籤
- 30. 我是否使用太多的MySQL查詢來獲取具有特定標籤的所有圖像?
如何獲取下一頁網址?我的意思是獲得下一組的反應在PHP或JavaScript? – user1788736
在響應中使用「next_url」以查詢更多結果。您可以在http://instagram.com/developer/endpoints/「分頁」部分閱讀更多內容。 –