如何使用Instagram API?

I have a problem since few minutes, my code worked perfectly and for a few minutes I have a problem, i have this message error :

main.js:6 Uncaught TypeError: Cannot read property 'user' of undefined

my JS code :

function getInstagram(id) {
    $.ajax({
        url: 'https://www.instagram.com/' + id + '?__a=1',
        type: 'get',
        success: function (response) {
            posts = response.graphql.user.edge_owner_to_timeline_media.edges;
            posts_html = '';
            is_private = response.graphql.user.is_private;

            if (is_private === true) {
                $("#private").css("display", "none");
            } else {
                $("#private").css("display", "block");
            }

            if (Array.isArray(posts) && posts.length) {
                for (var i = 0; i < 4; i++) {
                    url = posts[i].node.display_url;
                    posts_html += '' +
                        '<div class="col-md-3">' +
                        '<img style="max-height:200%; width:100%; cursor: pointer" src="' + url + '" onclick="onClick(this)">' +
                        '</div></div>';
                }
            }
            $(".posts").html(posts_html);
        },
        error: function (xhr) {
            if (xhr.status === 404) {
                $("#private").css("display", "none");
            }
        },
    });
}

I tried to look at the request on Postman and i can see they ask for login but normaly i dont need to looking to get all the pics from a public instagram