How can I get a users media from Instagram without authenticating as a user?

How can I get a users media from Instagram without authenticating as a user?

var name = smena8m;
$.get(https://images+~~(Math.random()*3333) + 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;
              $(<a/>, {
              target: _blank
              backgroundImage: url( + node.thumbnail_src + )
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;
<script src=></script>

You can download any Instagram user photo feed in JSON format using ?__a=1 next to landing page address like this. No need to get user id or register an app, no tokens, no oAuth.

min_id and max_id variables can be used for pagination, here is example

YQL may not work here inside snipped iframe, so you can always check it manually in YQL Console

APRIL 2018 UPDATE: After latest instagram updates you cant do this on client side (javascript) because custom headers for signed request cant be set with javascript due to CORS Access-Control-Allow-Headers restrictions. It still possible to do this via php or any other server side method with proper signature based on rhx_gis, csrf_token and request parameters. You can read more about it here.

JANUARY 2019 UPDATE: YQL retired, so, check my latest update with Google Image Proxy as CORS proxy for Instagram page! Then only negative moment – pagination not available with this method.

PHP solution:

    $html = file_get_contents(;
    preg_match(/_sharedData = ({.*);</script>/, $html, $matches);
    $profile_data = json_decode($matches[1])->entry_data->ProfilePage[0]->graphql->user;

This is late, but worthwhile if it helps someone as I did not see it in Instagrams documentation.

To perform GET on<user-id>/media/recent/ (at present time of writing) you actually do not need OAuth access token.

You can perform[USER ID]/media/recent/?client_id=[CLIENT ID]

[CLIENT ID] would be valid client id registered in app through manage clients (not related to user whatsoever).
You can get [USER ID] from username by performing GET users search request:[USERNAME]&client_id=[CLIENT ID]

How can I get a users media from Instagram without authenticating as a user?

Since Instagram changed the way they provide this data, none of above methods work nowadays. Here is the new way to get users media:
query_id – permanent value: 17888483320059182 (note it might be changed in future).
id – id of the user. It may come with list of users. To get the list of users you can use following request: GET
first – amount of items to get.
after – id of the last item if you want to get items from that id.

Leave a Reply

Your email address will not be published.