javascript - Get Instagram photos, count of likes and comment on website with jQuery or PHP
Get the solution ↓↓↓How can I get all photos and count of likes and comments of some instagram user into the website?
I tried many plugins or Instagram API, but nothing works. The plugins are only for 12 photos and don´t give me count of likes and comments. I need just some simple ajax request which give me urls of photos , likes and comments, but most importantly of all posts on Instagram account.
If anyone know how to do it or just give me hint where to find documentation of it, I will be thankful.
Thanks for your advices.
EDITED
I tried someting like this
<!DOCTYPE html>
<html>
<head>
<title>Instagram API</title>
<script src="https://code.jquery.com/jquery-3.3.1.min.js"
integrity="sha384-tsQFqpEReu7ZLhBV2VZlAu7zcOV+rXbYlF2cqB8txI/8aZajjp4Bqd+V6D5IgvKT"
crossorigin="anonymous"></script>
</head>
<body>
<div id="token-feed"></div>
<script>
var token = 'SHORT-LIVED-TOKEN', //there are my real values
username = 'MY-USERNAME', //there are my real values
num_photos = 4;
$.ajax({
url: 'https://api.instagram.com/v1/users/search',
dataType: 'jsonp',
type: 'GET',
data: {access_token: token, q: username},
success: function(data){
console.log(data);
$.ajax({
url: 'https://api.instagram.com/v1/users/' + data.data[0].id + '/media/recent',
dataType: 'jsonp',
type: 'GET',
data: {access_token: token, count: num_photos},
success: function(data2){
console.log(data2);
for(x in data2.data){
$('#token-feed').append('<img src="'+data2.data[x].images.thumbnail.url+'">');
}
},
error: function(data2){
console.log(data2);
}
});
},
error: function(data){
console.log(data);
}
});
</script>
</body>
</html>
But it shows me only this error:
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: cannot access offset of type string on string
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.