Reputation: 66
is there any way to retrieve images with a spesific hashtag from a spesific user from instagram with javascript or jQuery? If yes: how?
I am using the following wordpress plugin: Instagram Feed and its possible to add custom javascript and jQuery.
Upvotes: 0
Views: 1120
Reputation: 3472
There are two methods to do this using Instagram's API. You can either do an authenticated version or an unauthenticated version. If you want to get content dynamically by user, you are going to have to follow Instagram's Oauth process to get each user an access token.
Take a look at Instagram's API docs for users. You would need to make a choice between the following two endpoints:
Authenticated:
/users/self/feed
Unauthenticated:
/users/user-id/media/recent
Feel free to ask questions.
EDIT:
Below is some sample jQuery that I wrote a long time ago. One of the first times I used Instagram's API. This is an unauthenticated version that I used for my own feed. You would have to adjust the code, but this would point you in the right direction:
var end = "https://api.instagram.com/v1/users/791415154/media/recent/?client_id=YOUR_CLIENT_ID_HERE";
$.ajax({
type: "GET",
url: end,
dataType: "jsonp",
data: parms,
beforeSend: function(){
},
complete: function(){
},
success: function(res){
var links = res.data;
for(i=1;i<links.length;i++) {
var lead = links[i];
var src = lead.images.thumbnail.url;
var tag = lead.tags;
var image = lead.images.standard_resolution.url;
$("#insta-feed").append("<div class='insta-image-con'><img class='insta-image-img' src='" + src + "'/></div>");
}
Upvotes: 1