Rss-bridge: Why Instagram bridge does not work and possible solutions

Created on 9 Dec 2020  路  14Comments  路  Source: RSS-Bridge/rss-bridge

Recently there are a lot of new issues and comments about instagram bridge throwing 429 errors https://github.com/RSS-Bridge/rss-bridge/issues/1863 https://github.com/RSS-Bridge/rss-bridge/issues/1885 and even workaround from https://github.com/RSS-Bridge/rss-bridge/issues/1617#issuecomment-646679996 does not help.

First of all, I want to clarify, that there is no maintainer of InstagramBridge. Recent commit https://github.com/RSS-Bridge/rss-bridge/commit/56b2c516e49b26b26258fe11787518cae5737b10 had to be pushed long time ago. By maintainer I mean person, that at least fixes bugs or reports why it is certain bug is not fixable at the moment and comments on InstagramBridge PRs.

429 error means "Too many requests". It means that Instagram servers receive a lot of requests from your server (not only rss-bridge instance). So InstagramBridge on public and popular RSS-Bridge instance will probably throw this error.

There are opinions, if we make somehow InstagramBridge to login via existing account, it won't show such errors. To prove that in practice, private credentials feature has to be implemented. There is issue for that https://github.com/RSS-Bridge/rss-bridge/issues/1170 and draft PR https://github.com/RSS-Bridge/rss-bridge/pull/1343. But @teromene won't continue working on that PR, so someone has to continue his work.

Possible solutions for users:

  • Deploy RSS-Bridge on your personal PC or laptop and use InstagramBridge from there.
  • Deploy RSS-Bridge on your VPS, make sure that only certain people use it and use InstagramBridge from there.
  • Use bibliogram https://sr.ht/~cadence/bibliogram/ instead of RSS-Bridge.

Note, that deploying RSS-Bridge on shared hosting probably won't help, 'cos there would be other users making requests to instagram on the same server.

Most helpful comment

@Aasemoon Not from my end, need some feedback on what seems wrong in my commit, first.

All 14 comments

Deploy RSS-Bridge on your VPS, make sure that only certain people use it and use InstagramBridge from there.

This doesn't actually work. I've deployed my own instance with password protection and with only 4 user accounts to be fetched by bridge every hour, but there is still error.

Deploy RSS-Bridge on your VPS, make sure that only certain people use it and use InstagramBridge from there.

This doesn't actually work. I've deployed my own instance with password protection and with only 4 user accounts to be fetched by bridge every hour, but there is still error.

Same here, I'm the only one using the bridge on my proper instance (@home, not shared IP) and the problem persist.

I would like to investigate more, but the bridge is an hard piece, and I do not understand what is USER_QUERY_HASH as I mentionned in https://github.com/RSS-Bridge/rss-bridge/issues/1864#issuecomment-737345424.
We surely need a developer who knows how the GraphQL facebook API works.

Solution, as you said, is to have a private authentication method, and we should wait for https://github.com/RSS-Bridge/rss-bridge/issues/1170 and https://github.com/RSS-Bridge/rss-bridge/pull/1343
A few years ago I tried to implement such thing (for a MediapartBridge) but the work is outdated now.
Force to @teromene and you all! punch

For private accounts, take a look at https://github.com/dilame/instagram-private-api

429 error means "Too many requests".

I confirm. Switched my feeds to update once a day and no more error. Thanks for the tip.

@em92 Maybe I'm crazy or misreading things, but I'm not sure the GraphQL endpoints are going to work for login based feeds. In the API overview they are pretty clear that Facebook business accounts connected to an Instagram account are required and that business validation is needed.

I'm guessing this is why projects like Instagram Private API went the route of using the consumer API and adding in the extra calls to look like Android for good measure. Facebook even states in their documentation that: _"The API cannot access Instagram consumer accounts (i.e., non-Business or non-Creator Instagram accounts). If you are building an app for consumer users, use the Instagram Basic Display API instead."_

Perhaps GraphQL could work, but a quick dive in doesn't seem to be the case. It seems more like the Instagram Bridge would need to be converted over to the consumer API. However, I'm totally new to this, so I could be way off base.

Just pushed teromene's patch to add possibility to use private credentials. Example usage is given in first message of PR https://github.com/RSS-Bridge/rss-bridge/pull/1343

So, if anyone wants to make changes to InstagramBridge to use those credentials - feel free to do it. Just for any case post message here like "I am going to do this", just to make sure that none is making same patch simultaneously.

@Fmstrat, your message could be useful to InstagramBridge maintainer, but there is none at the moment.

If a maintainer comes along (or I eventually get time), a bit more research into this looks like you can use the GraphQL endpoint "privately" within a user session with a CSRF token. This is how Instaloader handles it in their JSON call. They get a token, then create the session, then they use the session, then grab the JSON with that session.

Recreating that process should do the trick.

Well, that was easy. Initial PR is in: https://github.com/RSS-Bridge/rss-bridge/pull/1894

Actually, hold on that PR. I figured out if I modify the storage to the cookie text, then I can fix the username/id bug, too. ;)

If I understand what鈥檚 happening, another solution could be to throttle the requests (based on the number of feeds making requests to Instagram API) instead of falling back to logging in. Is that possible?

That way, people without an Instagram account would not be excluded.

@arkhi The problem is that kind of delay needs to come from the reader, not the bridge, or the reader may timeout.

@em92 I'll be working today to do a more formal login similar to the style of Instaloader.

Alrighty, I feel like I'm 95% done, but can't seem to get the sessionid back in the post-login header. Maybe someone here can help out? @em92 if I can figure this out I can probably keep this maintained, too.

Here's the changes: https://github.com/Fmstrat/rss-bridge/commit/f6258920d60c28501e2d736f122f02aa3d5f11b5

To test it out, you'll need to put your username/password in here: https://github.com/Fmstrat/rss-bridge/blob/private_insta/bridges/InstagramBridge.php#L141 (Until I integrate into the private feed option that was recently merged.

The problem is when calling the login, the sessionid variable never comes back. This could be as simple as a failed login and I'm just not seeing why. @em92 am I using the post options the way you would expect with json_encode?

In the linked file you can see on line 110 there is a sessionid cookie returned, which does not occur when I make the request in my code.

Request logs: instalogin.txt

Thanks!

Has there been any updates for this issue? Any hope of a solution?

@Aasemoon Not from my end, need some feedback on what seems wrong in my commit, first.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

AntoineTurmel picture AntoineTurmel  路  7Comments

eyoungmin picture eyoungmin  路  8Comments

lboullu picture lboullu  路  9Comments

OmkAR2013 picture OmkAR2013  路  8Comments

WebworkrNet picture WebworkrNet  路  8Comments