Instagram Feed

by Vladimir Sobolev

SCSS

html, body {
  font-size: 0;
  line-height: 0;
}

a {
  display: inline-block;
  width: 25%;
  height: 0;
  padding-bottom: 25%;
  background: #eee 50% 50% no-repeat;
  background-size: cover;
}

JavaScript

var name = "smena8m",
  items;
$.get("https://images"+~~(Math.random()*33)+"-focus-opensocial.googleusercontent.com/gadgets/proxy?container=none&url=https://www.instagram.com/" + name + "/", function(html) {
  if (html) {
  	var regex = /_sharedData = ({.*);<\/script>/m,
    		json = JSON.parse(regex.exec(html)[1]),
        edges = json.entry_data.ProfilePage[0].graphql.user.edge_owner_to_timeline_media.edges;
    $.each(edges, function(n, edge) {
    	var node = edge.node;
      $('body').append(
        $('<a/>', {
          href: 'https://instagr.am/p/'+node.shortcode,
          target: '_blank'
        }).css({
          backgroundImage: 'url(' + node.thumbnail_src + ')'
        }));
    });
  }

});