cosenary/Instagram-PHP-API

Instagram Platform Update

vinkla opened this issue · 45 comments

On the 17 Nov 2015 Instagram made changes to their API . Apps created before Nov 17, 2015 wont be affected until Jun 2016. Apps created on or after Nov 17 2015 will require to use their updated API. Please note that this library doesn't yet support their new updates.

When we launched our first Instagram API in 2011, we were a very small team and knew we wouldn’t be able to build all the features our community might want. Today we are announcing several platform changes to improve people’s control over their content and set up a more sustainable environment built around authentic experiences on the platform…
http://developers.instagram.com/post/133424514006/instagram-platform-update

I guess we need to rethink this entire library in order to work with the latest changes. This will require a lot of efforts and there is currently no plan to update this library.


If you're just looking for a simple way to fetch a public Instagram feed, you can checkout this package: vinkla/instagram.

bcbud commented

Looks like they updated /media/search to require auth...

Instagram.php (227)

 public function searchMedia($lat, $lng, $distance = 1000, $minTimestamp = NULL, $maxTimestamp = NULL) {
    return $this->_makeCall('media/search', false, array('lat' => $lat, 'lng' => $lng, 'distance' => $distance, 'min_timestamp' => $minTimestamp, 'max_timestamp' => $maxTimestamp));
  }

needs the false $auth to be set to true

 public function searchMedia($lat, $lng, $distance = 1000, $minTimestamp = NULL, $maxTimestamp = NULL) {
    return $this->_makeCall('media/search', true, array('lat' => $lat, 'lng' => $lng, 'distance' => $distance, 'min_timestamp' => $minTimestamp, 'max_timestamp' => $maxTimestamp));
  }
jufy commented

Also need to update scopes
https://instagram.com/developer/authorization/
— basic - to read a user’s profile info and media (granted by default)
— public_content - to read any public profile info and media on a user’s behalf
— follower_list - to read the list of followers and followed-by users
— comments - to post and delete comments on a user’s behalf
— relationships - to follow and unfollow accounts on a user’s behalf
— likes - to like and unlike media on a user’s behalf

Hi,
now even the getTagMedia needs an access_token to work.
I have a big doubt: how can I have access to recent media without making the user to login?
I explain myself: I built a website with a backend area. In this area I add the authentication data for an Instagram app (Client ID and Client Secret) and a tag. The frontend shows the recent medias for that tag. Simple.
Now things are changed and an access_token is needed.
So how can I show the same recent medias without make the user login to Instragram? The app only shows the global recent medias, not user info.
I reviewed the repository code, but I cannot understand how THE APP could generate via code an access_token to be used for recent media query.

Thanks for your time.

Simone.

iadj commented

Is it possible to still use this API with the update apart from some of the features that require updating the API?

To fix photo uploading...

  1. In Instagram::GenerateSignature() replace the key with:
    3f0a7d75e094c7385e3dbaa026877f2e067cbd1a4dbcf3867748f6b26f257117
  2. Replace the User Agent with:
    Instagram 7.1.1 (Android; 21/5.0.2; 480dpi; 1080x1920; OnePlus/ONEPLUS; A0001; A0001; qcom; en_US)
  3. Set ig_sig_key_version=6 to ig_sig_key_version=4.

@iadj Yes it is. I'm still currently using it to fetch hashtag based media but have lost access to user media due to the public_content scope addition.

the scopes problem is easily patched by editing line 74 to read:

private $_scopes = array('basic', 'public_content', 'follower_list', 'likes', 'comments', 'relationships');

I'm getting turned down couple of times for submission on basic and public_content, what actually I have to provide for the submission? I just want to curl trending Instagram photos into php
this is sample for now as I can only curl for my own media only

https://sanik.my/gallery/instagram

any insights?

Hello, did anyone get the permission review accepted after the update? I followed the valid use cases and i got the permissions declined everytime i tried it. Thanks

I'd give up on instagram if I were you. They don't like anyone but them
making money from their platform, and they could give a shit about the
developers. They change the rules all the time, usually without warning.

On Mon, Feb 1, 2016 at 8:35 AM, Brumley notifications@github.com wrote:

Hello, did anyone get the permission review accepted after the update? I
followed the valid use cases and i got the permissions declined everytime i
tried it. Thanks


Reply to this email directly or view it on GitHub
#182 (comment)
.

I've just submitted a pull request #204 that should fix this package to work with Instagram's API changes.
@cosenary please consider merging this in and thanks for your very helpful library!

Until this is fixed everyone could check out this repository https://github.com/hassankhan/instagram-sdk

Why don't you accept pull requests on this repo?
In #204 I fixed everything and as far as I can see it's perfectly usable again.

Please bare in mind that I'm not the maintainer. I've only helped out with the syntax changes.

Sorry, I thought you had merge rights as well.
Anybody knows if the author is still willing to maintain this project? If not, I'll switch out this package with my fork in my composer.json and be done with it.

iadj commented

@florianbeer Please do. Last time this git was updated was last year.

@florianbeer Could you publish your fork? And we will be able to enjoy this library with new API

Yes. But it is still "fork". It would be great if you changed name of library from "cosenary/instagram" to your. So we can use composer to upload it.

But that would be stealing, it is still @cosenary's work.

You can add the following to your composer.json to use my fork:

"repositories": [                                                                                                                                                                
    {                                                                                                                                                                            
        "url": "https://github.com/florianbeer/Instagram-PHP-API.git",                                                                                                           
        "type": "git"                                                                                                                                                            
    }                                                                                                                                                                            
],

and then require "cosenary/instagram": "dev-master"

But if I use "dev-master" - it upload a last stable commit.
How can I use your last commits?

Yes. It works now. But I have now

Invalid state

        || ($this->getInput('state') !== $this->store->get('oauth2state'))
    ) {
        $this->store->set('oauth2state', null);
        throw new CsrfException('Invalid state');
    }
    return;
}

hello guys, has anything changed with API permission review? Did anyone get the permission from instagram to any scope? Thanks

@florianbeer , this is an open-source project. If @cosenary is no longer maintaining it (and that seems to be the case given that he hasn't chimed in on any of this yet), creating a new non-forked repo that gives attribution to @cosenary seems to me to be a legitimate way to keep the project moving forward. For those of use who are trying to build production-level systems, it would be nice to be able to include a stable source in our composer setup. Thanks!

This package is still 99,9% @cosenary's work. If he wants me to take over and clearly states so, I will think about it, not sooner. If you want to use my fork in the meantime, you can alter your composer.json to fetch the code from my repository.

@florianbeer, with the repositories inside of composer.json and dev-master won't work. See composer/composer#2622

Supposed that @cosenary are no longer interested in development on Github anymore.

I'm assuming this API is dead now that is hasnt been updated to the new Instagram API changes of last year? So its not worth utilizing at all?

@florianbeer if cosenary is not here to maintain a broken system, It must move on. No matter who created the work. It must move on and adapt. If it's from the original author or not. That is open source.

@florianbeer Do we have any update on this issue? If anyone want to take the responsibility of this repo, can we just create a fresh one without hurt anybody? It's really blocking for a lot of people.

Well I would be open to maybe transferring my fork to a GitHub organisation and publishing it to Packagist if I can get some co-maintainers. I don't think there's enough incentive for me to take care of issues, PRs etc. all on my own, seeing that my fork does everything I need it to do for my project for the foreseeable future.

So any volunteers to take on a (co-) maintainer role in an open source project and spending countless hours of unpaid work on keeping it up to date?

@florianbeer I want to volunteer, since I'm gonna also use the API for some prototyping, might as well explore the API depthly and help the public.

@florianbeer I'm gonna help as well if you are not have concerns. Currently I had to do a fork from your fork and created a Composer package on its basis: https://github.com/propeopleua/Instagram-PHP-API

But I do not like this!

@dimassrio I've added you as collaborator (push permission) on my repository and will publish it on packagist today.

Anybody else who wants to participate, please feel free to give me a shout!

@BR0kEN- great, you're added as well.

Hmm, seems I have to "un-fork" (is that the correct GitHub terminology), to publish to packagist. I will investigate further later today, as now I have to leave for a meeting.

@florianbeer cool! I can help, no problem!

@florianbeer, you can publish forks but this practice isn't recommended. So, better to create an independent package.

Hi @florianbeer, any news on this?

Lookin forward to use your fork @florianbeer

@florianbeer This again .. ;)
Actually, if you rename your forked branch as dev-master, we will be able to use your repository in composer. See http://stackoverflow.com/questions/13498519/how-to-require-a-fork-with-composer. I just tried by forked your branch and it worked.

It has been over a year now. I'm closing this.

If you're looking for a simple way to fetch a public Instagram feed, you can checkout this package: vinkla/instagram.