jsanahuja / jquery.instagramFeed

Instagram Feed without access token. Not using the Instagram API
MIT License
313 stars 164 forks source link

Stopped working #103

Closed luizping closed 3 years ago

luizping commented 3 years ago

I think IG changed the policy. Now to see a user page, you have to be logged in. So when you run the script, the GET returns the IG Login Page content.

mahotilo commented 3 years ago

My IP is now banned, so I can't do a clear check. But yes, something has changed for me too. I will check later if this new IG behaviour is permanent or only for banned IPs.

benbracedigital commented 3 years ago

I'm getting the same issue too after a couple of page views Instagram isn't returning any images and in the console I get

Instagram Feed: It looks like YOUR network has been temporary banned because of too many requests. See https://github.com/jsanahuja/jquery.instagramFeed/issues/25

web-assistant commented 3 years ago

I'm also seeing the temporary banned message

mahotilo commented 3 years ago

@benbracedigital Were you able to see images today before ban? What cache_time had you had?

benbracedigital commented 3 years ago

Yes I was and I could see the images on a different server this morning but after a couple of refreshes, I get the error message. I've set the cache_timeto 120.

mahotilo commented 3 years ago

It seems like 120min is not enough now. The new default and recommended value is 6 hours (360)

benbracedigital commented 3 years ago

Sure, happy to increase to 6 hours but I would expect it to be cached for 2 hours previously and still work rather than error and not show images within minutes?

mahotilo commented 3 years ago

What version of the script do you have? I can see cached images even in the ban. And true, with an error in the console

benbracedigital commented 3 years ago

version 1.3.6

mahotilo commented 3 years ago

Caching is only available since 2.0.0

benbracedigital commented 3 years ago

Ah, thank you. I'll download the latest version and see what results I get.

mahotilo commented 3 years ago

But only after the end of the ban. I mean "will see" :)

benbracedigital commented 3 years ago

I can at least see cached images now. I'm going to deployed to a different (non banned) server to see if that all works.

mahotilo commented 3 years ago

Your (browser) IP is banned, not the IP of the server of your page. Personally, I am currently banned on my PC, but I can flawlessly see the script results on my phone with mobile internet.

benbracedigital commented 3 years ago

Looks to be working. Thanks for your help

mahotilo commented 3 years ago

@luizping

I think IG changed the policy. Now to see a user page, you have to be logged in. So when you run the script, the GET returns the IG Login Page content.

I am finally able to check your issue after my last ban ended. The redirect to IG Login Page is only related to the ban. Now, I am able to open and preview any IG page with only offer to register at the bottom.

mahotilo commented 3 years ago

Yeah, it looks like these are tough times. IG has banned me right after the first successful page update. And ban will last 2-3 days, I expect. Really tough.

Federico-Iglesias commented 3 years ago

@mahotilo how are you? Is to possible to avoid this issue by using cache_time setting? Thanks!

mahotilo commented 3 years ago

Is to possible to avoid this issue by using cache_time setting? Thanks!

The cache_time is the only cure we have, It works. But it is very easy to catch a ban if you simultaneously use the script on different sites and make experiments :) I am thinking of increasing the cache_time up to 24 h for myself to avoid future bans.

pabrul commented 3 years ago

I'm kind of on an "eternal ban", because sometimes the feed appears and sometimes not, the same happens with this error, sometimes it appears on the console and sometimes it doesn't, I really don't know what to do anymore :(

pabrul commented 3 years ago

image

mahotilo commented 3 years ago

@pabrul

...I really don't know what to do anymore :(

First of all, you should update your script to the latest version 2.0.1 This is how your console should look like in case of a ban.

image

no-liver commented 3 years ago

Having the same issue, updated to ver 2.0.1 and console reads: jquery.instagramFeed.min.js:98 Instagram Feed: Your network has been temporary banned by Instagram because of too many requests. Consider increasing your 'cache_time'. See https://github.com/jsanahuja/jquery.instagramFeed/issues/25 and https://github.com/jsanahuja/jquery.instagramFeed/issues/101 4

Increased cache_time: 360 4 days ago and no change.

Any suggestions to proceed?

mahotilo commented 3 years ago

Any suggestions to proceed?

Wait until IG unbans you. Last time, 3 days were enough for me.

mahotilo commented 3 years ago

Well, what I have found about the ban from IG.

  1. The script and the caching approach work fine. You can update script output on 1-2 pages without being banned.
  2. But, @jsanahuja... It seems to me, the demo page that has 4 calls of script in a raw with different username + 1 call with a tag might be the point where the visitors get banned.
jsanahuja commented 3 years ago
  1. But, @jsanahuja... It seems to me, the demo page that has 4 calls of script in a raw with different username + 1 call with a tag might be the point where the visitors get banned.

Maybe we should change it to use the same username on all the examples. The tag call doesn't matter because it never gets banned as far as I know

mahotilo commented 3 years ago

The tag call doesn't matter because it never gets banned as far as I know

I also think so.

Maybe we should change it to use the same username on all the examples.

Or maybe the function should be called only when the corresponding tab is opened? Barcelona should be kept:)

jsanahuja commented 3 years ago

Or maybe the function should be called only when the corresponding tab is opened?

Mmm, way better

Barcelona should be kept:)

Hahaha, for sure 😄

ReneR97 commented 3 years ago

Just have a question for clarification, if i get banned on one page, will i be banned on all pages that use this script, or is the ban on a per page basis? or is it on a per instagram page basis?

mahotilo commented 3 years ago

I believe, it is a ban on your IP. Any nonlogged-in requests from your IP are banned by IG during the ban period.

mahotilo commented 3 years ago

One last time (hopefully) My clear experiment

  1. No ban, more than 6 h after the last update
  2. My first test page (1 "name" script instance)
  3. Demo page (4 "name" script instances)
  4. My second test page (1 "name" script instance)
  5. Ban

Magic number is 6.

I think this issue should be closed. It has nothing to do with script and caching. It is about the number of script calls.

m0nclous commented 3 years ago

104 Feature/proxy this may solve the problem.

But it needs testing. This is still a draft. I can post a backend heroku, everything is easy there.

mahotilo commented 3 years ago

Hm, it doesn't work for me https://instagram-feed-proxy.herokuapp.com/?url=https://www.instagram.com/instagram

image

m0nclous commented 3 years ago

Hm, it doesn't work for me https://instagram-feed-proxy.herokuapp.com/?url=https://www.instagram.com/instagram

image

This is normal. You only need to get _sharedData from html response. This proxy is only needed to execute the script when requested via ajax get

You can test this without the caching feature that was added earlier.

image

m0nclous commented 3 years ago

@mahotilo I hope you understand what I'm talking about. I'm not very good at translating into English, sorry.

mahotilo commented 3 years ago

@m0nclous

I hope you understand what I'm talking about.

Not a problem.

This is normal. You only need to get _sharedData from html response.

Yes, I can reproduce your example with _sharedData. Thx.

mahotilo commented 3 years ago

@m0nclous

Well, I have just tested it by changing the host attribute to proxy. 'host': 'https://instagram-feed-proxy.herokuapp.com/?url=https://www.instagram.com/',

It works well. Hurrah! But why do we need to introduce two new attributes just to change the value of the host? Wouldn't it be easier to add the proxy address to the documentation as a recommended alternative to the host value?

P.S. Funny. Today I had to open over 20 IG pages to get banned :)

mahotilo commented 3 years ago

As I can see it, this solution has previously been described here https://lopodofoodservice.com/assets/js/plugins/instagramfeed/ but with another proxy EDIT I mean, the proxy may or may not work. We cannot rely too much on third-party solutions. When the users themselves change the host, it is their decision and a headache to check the proxy health.

m0nclous commented 3 years ago

But why do we need to introduce two new attributes just to change the value of the host?

Yeah, this is the best solution

m0nclous commented 3 years ago

Funny. Today I had to open over 20 IG pages to get banned :)

The whole problem is session related.

You can't create more than two (or three, haven't tested it) sessions from one IP. If you clear your cookies, you will lose the session ID, thereby losing access to the instagram view, for example through incognito mode.

But by saving your session, you can view without restrictions. On heroku there is no request proxying through third-party servers, there is just a request with the same session ID in the cookie.

mahotilo commented 3 years ago

But by saving your session, you can view without restrictions.

Hm, I guess this is the number of usernames views per day that is limited by IG for one IP. Today to get a ban I clicked on near 20 profiles on https://www.instagram.com/explore/tags/paradise. It was in incognito mode in one session.

m0nclous commented 3 years ago

Hm, I guess this is the number of username views per day that is limited by IG for one IP. Today to get a ban I clicked on near 20 profiles on https://www.instagram.com/explore/tags/paradise. It was in incognito mode in one session.

My mistake. It turns out I was using my account session. 🤦‍♂️ Heroku sends requests from my session and returns the result.

How many views will last before blocking or captcha? I think I need to install and test the logger. But at least this solves the problem, especially if you are using caching.

mahotilo commented 3 years ago

How many views will last before blocking or captcha?

So far, I have run the script with the proxy in the host over 20 times in different incognito sessions. It still works like a charm!

But at least this solves the problem, especially if you are using caching.

It looks like a complete victory. I cross my fingers.

m0nclous commented 3 years ago

The result of the discussion: all you need to do is specify 'host': 'https://instagram-feed-proxy.herokuapp.com/?url=https://www.instagram.com/' (or another proxy of your choice) in instagramFeed settings.

I will continue to explore caching, proxying and process optimization on heroku app, after which I will post it to the public.

mahotilo commented 3 years ago

@m0nclous, @jsanahuja Would you make a PR for the documentation? Maybe here? image

m0nclous commented 3 years ago

@mahotilo I figured out how to do without a proxy.

To do this, you need to know the user id, from where the pictures will be taken. https://www.instagram.com/web/search/topsearch/?query=<username>

Then we make a request with the found id https://instagram.com/graphql/query/?query_id=17888483320059182&variables={"id":"<user_id>","first":20,"after":null}

Thus, you can keep the ability to insert instagram via username.

The ID can be cached in order not to receive it all the time.

I don't see any blocking from instagram. I should be able to implement this in 1-2 days, including the vanilla plugin.

The question remains how to get data from the tag without blocking.

https://stackoverflow.com/questions/17373886/how-can-i-get-a-users-media-from-instagram-without-authenticating-as-a-user/47243409#47243409 https://stackoverflow.com/questions/11796349/instagram-how-to-get-my-user-id-from-username/52808289#52808289 https://github.com/jsanahuja/InstagramFeed/issues/49#issuecomment-758598459

mahotilo commented 3 years ago

It seems that the tag is never blocked.

m0nclous commented 3 years ago

Then there is no problem. I will try to find time tomorrow and implement what I wrote above for testing. It looks like the issue will be resolved.

web-burn commented 3 years ago

@mahotilo, any news about fix?
Currently the fix with proxy host: "https://instagram-feed-proxy.herokuapp.com/?url=https://www.instagram.com/'" doesn't work.

mahotilo commented 3 years ago

Currently the fix with proxy host: "https://instagram-feed-proxy.herokuapp.com/?url=https://www.instagram.com/'" doesn't work.

Unfortunately, that is to be expected. IG is hard to cheat. But caching still does the trick. It is not perfect but quite acceptable.

@m0nclous, do you have any new findings?