Skip to content
This repository has been archived by the owner on May 3, 2021. It is now read-only.
This repository has been archived by the owner on May 3, 2021. It is now read-only.

Failed to load resource: the server responded with a status of 400 () #133

Open
@georgiyboekov

Description

Hello,

I've managed to get the Instagram Feed working, but at times, the console throws an error - *Failed to load resource: the server responded with a status of 400 ()

I have the following script written:

`(function($){
var defaults = {
'username': '',
'container': '',
'display_profile': true,
'display_biography': true,
'display_gallery': true,
'get_raw_json': false,
'callback': null,
'styling': true,
'items': 8,
'items_per_row': 4,
'margin': 0.5
};
$.instagramFeed = function(options){
options = $.fn.extend({}, defaults, options);
if(options.username == "" && options.tag == ""){
console.log("Instagram Feed: Error, no username or tag found.");
return;
}
if(!options.get_raw_json && options.container == ""){
console.log("Instagram Feed: Error, no container found.");
return;
}
if(options.get_raw_json && options.callback == null){
console.log("Instagram Feed: Error, no callback defined to get the raw json");
return;
}

var url = 'https://images' + ~~(Math.random() * 3333) + '-focus-opensocial.googleusercontent.com/gadgets/proxy?container=none&url=https://www.instagram.com/' + options.username;

$.ajax({
url: url,
type: 'GET',
success: function (data){
console.log(data.organizations[0].name);
var organisation = data.organizations[0].name;
$("#company").text(organisation);
}
});

$.get(url, function(data){
    console.log(data);
		data = data.split("window._sharedData = ");
		data = data[1].split("<\/script>");
		data = data[0];
		
		data = data.substr(0, data.length - 1);
		data = JSON.parse(data);`

The script is working and it's displaying the feed, but at times it stops and I have to retry for multiple times until it gets to work again. I've went through all threads and I believe there is no workaround on this case, but any tips at least to mitigate the problem are highly appreciated. I hope the discussion and the code is helpful to other users as well.

Kindest regards,
Georgiy

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions