Instagram API Help to get photos from a Hashtag

1

Hello everyone, I want to start a web app with the Instagram API, to crawl a hashtag and return the photos published with me.

I already checked the API, but I do not have much experience using it, can someone help me? thank you all

    
asked by Cristian Rivas Buitrago 18.06.2016 в 16:28
source

1 answer

1

You must download a js from the page Instafeedjs

Then in your instagram they provide you with a user ID, which you will use in the Javascript of the page. I the code that I used is this

<script type="text/javascript" src="js/instafeed.min.js"></script>
<script type="text/javascript">
var loadButton = document.getElementById('load-more');
var loadButton2 = document.getElementById('load-more2');

feed = new Instafeed({

userId: TU USER ID,
accessToken: 'TU TOKEN',
tagName:'Hastag a buscar',
sortby: 'most-recent',
get: 'tagged',
resolution: 'thumbnail',
links: 'true',
template: '<a href="{{link}}" target="_blank"><img src="{{image}}" /></a>&nbsp;&nbsp;&nbsp;',
limit: 60,

after: function() {
    // disable button if no more results to load
    if (!this.hasNext()) {
      loadButton.setAttribute('disabled', 'disabled');
    }
},
 });
 loadButton.addEventListener('click', function() {
 feed.next();
});

 feed.run();

The HTML code is

<div id="instafeed"></div>
    <input type="button" id="load-more" name="load-more" class="main" value="Mas fotos">
    
answered by 19.06.2016 / 11:43
source