Instagram API Tag

0

What about friends, I come with a problem that has me crazy, and that is that I'm using the instagram API to get photos through a hashtag, what happens is that it worked normally until a few days ago, and today I'm surprised that does not work anymore. Delete the Instagram application and re-create another one.

Use the following string to generate the TOKEN with various permissions ...

https://api.instagram.com/oauth/authorize?client_id={CLIENTE ID}&redirect_uri={URL-REDIRECCION}&response_type=token&scope=basic+public_content+follower_list+comments+relationships+likes

Having this, I thought I had already obtained everything ...

But oh surprise ... I get the following:

  

deprecation_warning: "next_max_id and min_id are deprecated for this   endpoint; use min_tag_id and max_tag_id instead "

I attach the code I was using

HTML

<div id="instagram"></div>
    <div class='clearfix'></div>
    <!-- button -->
    <div id="showMore">
        <div class='clearfix '><a id='more' next_url='"+next_url+"' href='#'>[Load More]</a></div>      
    </div>

Javascript

var access_token = "TOKEN";
var resolution = "thumbnail"; 
var hashtag = "life";
var last_url = "";
var start_url = "https://api.instagram.com/v1/tags/"+hashtag+"/media/recent?access_token="+access_token;

function loadEmUp(next_url){

    console.log("loadEmUp url:" + next_url);
    url = next_url;

    $(function() {
        $.ajax({
                type: "GET",
                dataType: "jsonp",
                cache: false,
                url: url,
                success: function(data) {

                next_url = data.pagination.next_url;
                count = 20; 
                //console.log("count: " + count );
                console.log("next_url: " + next_url );
                console.log("data: " + JSON.stringify(data) );

                for (var i = 0; i < count; i++) {
                        if (typeof data.data[i] !== 'undefined' ) {
                        //console.log("id: " + data.data[i].id);
                            $("#instagram").append("<div class='instagram-wrap' id='pic-"+ data.data[i].id +"' ><a target='_blank' href='" + data.data[i].link +"'><span class='likes'>"+data.data[i].likes.count +"</span><img class='instagram-image' src='" + data.data[i].images.low_resolution.url +"' /></a></div>"
                        );  
                        }  
                }     

                //console.log("next_url: " + next_url);
                $("#showMore").hide();
                if (typeof next_url === 'undefined' || next_url.length < 10 ) {
                    console.log("NO MORE");
                    $("#showMore").hide();
                    $( "#more" ).attr( "next_url", "");
                }


                else {
                    console.log("displaying more");
                    $("#showMore").show();
                    $( "#more" ).attr( "next_url", next_url);
                    last_url = next_url;

                }
            }
        });
    });
}




$( document ).ready(function() {
    $("#more" ).click(function() {  
        var next_url = $(this).attr('next_url');
        loadEmUp(next_url);
        return false;
    });

    loadEmUp(start_url);


});
    
asked by cignius 25.08.2016 в 05:37
source

1 answer

0

What about friends, I know that this question abounds a lot on the internet, the procedure I have used is appropriate and has nothing to do with:

  

deprecation_warning: "next_max_id and min_id are deprecated for this endpoint; use min_tag_id and max_tag_id instead"

It continues to work, although this is nothing more than a warning that the parameters are in disuse and has nothing to do with the problem we have.

The solution:

The important part is in the token that we generate, when using the sentences that comment on the question:

https://api.instagram.com/oauth/authorize?client_id={CLIENTE ID}&redirect_uri={URL-REDIRECCION}&response_type=token&scope=basic+public_content+follower_list+comments+relationships+likes

This makes an authorization of "us to us" so to speak, but call me crazy ... xD I found and traveled almost 30 pages of google that I found a page that makes an authorization to our token, causing it to obtain Permissions to us for our application. It's kind of weird but it works.

I enclose the link here for those who have the same problem, obviously to be able to use it, you have to do the steps that follow in the following link

And in the api says this:

  

This use case is not supported. We do not approve the public_content permission for one-off projects such as displaying hashtag based content on your website. As an alternative solution, you can show your own Instagram content, or find a company that offers this type of service (content discover, moderation, and display).   You can find more information in the Permission Review documentation.

    
answered by 25.08.2016 / 16:44
source