Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[InstagramEmbedBridge] Add a new Instagram Bridge based on the embed url #4060

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sysadminstory
Copy link
Contributor

This bridge is a simplified version of InstagramBridge that is based on the embed page of a profile page.

It does only support the Username mode, and is limited to the last 6 medias.

At least actually, it does not need any cookies, and does work from a server IP, without limitation.

This bridge is a simplified version of InstagramBridge that is based on
the embed page of a profile page.

It does only support the Username mode, and is limited to the last 6
medias.

At least actually, it does not need any cookies, and does work from a
server IP, without limitation.
Copy link

github-actions bot commented Apr 4, 2024

Pull request artifacts

Bridge Context Status
InstagramEmbed 1 Username (pr) ✔️

last change: Thursday 2024-04-04 21:40:30

@Mynacol
Copy link
Contributor

Mynacol commented Apr 18, 2024

Nice job. The feed works fine, but I have some issues with the media links.

The embedded images/videos aren't displayed, as Instagram sends the cross-origin-resource-policy: same-origin header, which all browsers lead to not allow this request to finish.
Opening the non-direct media link (ending with /media?size=l) also doesn't work, presenting a "page not found" error. Accessing the URL from a new window leads to the desired image. The reason clicking on the link directly doesn't work seems to be the Sec-Fetch-Site: cross-site header, which tells Instagram this is a request originating from another origin. Instagram then returns a HTTP 404 error.

Finally, the direct media links work, but produce a "URL signature mismatch" sometimes/after some time, which is unfortunately expected.

@dvikan
Copy link
Contributor

dvikan commented Apr 18, 2024

I would prefer merging this change into the existing instagram bridge so that current feeds start working again.

if it's too much work, im ok with merging this.

i am guessing that also the embed has some form of rate limits though...

@Bockiii
Copy link
Contributor

Bockiii commented Apr 19, 2024

Fully agree with you dvikan. Instagram has always been one of the main problem-bridges. If this can at least restore parts of the functionality, it will probably help 99% of the users of the old bridge and all of the instagram issues can be closed

@sysadminstory sysadminstory marked this pull request as draft April 19, 2024 15:37
@sysadminstory
Copy link
Contributor Author

I can try to merge this change to the existing Instagram bridge, but I have some question about the merge :

  1. Should I add a new specific context to create a "use embed instagram" feed ?
  2. Should I use the "embed instagram" method as a fallback when direct access to instagram is not possible ?
  3. Should I add a parameter to the existing contaxt ?

In the case of question 2, how should the Feed reader be informed that the method used can not display some media types (stories / reels / whatever they call them) ?
In case of question 3, how should I inform the user that choosing the "use embed instagram as source" can lead to a limitation of the media he will get ?

@sysadminstory
Copy link
Contributor Author

@Bockiii @dvikan What's your opinion ? :)

@Mynacol
Copy link
Contributor

Mynacol commented May 27, 2024 via email

@Bockiii
Copy link
Contributor

Bockiii commented May 29, 2024

In regards to techincal debt, I always prefer to just do one thing one time. The fallback option has the benefit that the users wont have to change anything, but adds a new layer to a already complex bridge which makes it harder to maintain or grasp for possible maintainers.

If you can manage to make it a sensible failover, go for option 2 I guess. I dont think an extra bridge or marker would benefit anyone.

@TReKiE
Copy link
Contributor

TReKiE commented Sep 9, 2024

I've had this on my instance for a while working without issue, but it broke today. It's easily fixed by editing the regex on line 53:

$regex = '#"contextJSON":"(.*)"}\]\],\["NavigationMetrics"#m';

For some reason, there's some weird unicode being added after NavigationMetrics and before ", which breaks it. The simple fix seems to be to remove the trailing ", as it will still match and parse correctly.
i.e. $regex = '#"contextJSON":"(.*)"}\]\],\["NavigationMetrics#m';

@sysadminstory
Copy link
Contributor Author

I've had this on my instance for a while working without issue, but it broke today. It's easily fixed by editing the regex on line 53:

$regex = '#"contextJSON":"(.*)"}\]\],\["NavigationMetrics"#m';

For some reason, there's some weird unicode being added after NavigationMetrics and before ", which breaks it. The simple fix seems to be to remove the trailing ", as it will still match and parse correctly. i.e. $regex = '#"contextJSON":"(.*)"}\]\],\["NavigationMetrics#m';

I was trying to integrate the fallback to the embed in the existing Instagram Bridge, but now, even the embed url shows the login page. I can reproduce the same behavior on the InstagramEmbed Bridge.

Is the InstagramEmbedBridge still working on your side ?

@TReKiE
Copy link
Contributor

TReKiE commented Nov 2, 2024

Yep, still working for me, both with existing feeds/users and some random new ones.

I'm not sure how much code is shared between the Meta sites, but I've regularly had reasons to make use of Facebook without being logged in, and discovered that its login screen is inconsistently forced there. I've seen it both randomly forced, as well as seemingly becoming forced from dismissing it too many times (in say, an hour). In both cases, it became dismissible again after a few days. Currently, I can bypass that login screen without issue as well.

To be specific, right now, the IG embed links open up without a login screen for me. I did have to deal with the CORS policy in the bridge's HTML output, but I don't think that's the problem here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants