Skip to content

[Instagram] Handle instagram.com/share/ URLs generated by the mobile app #7241

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

Merged
merged 1 commit into from
Apr 19, 2025

Conversation

DjofPlusPlus
Copy link
Contributor

As of december 2024, when copying the URL of a post from the Instagram Android app (I assume it's the same on other platforms) the real URL and tracking information are wrapped into a redirect formatted like: https://www.instagram.com/share/reel/BARSSL4rTu

The real post shortcode is not the same. Making a GET on this URL with proper Sec-Fetch headers, Instagram gives a code 302 response, with the real URL in the Location headers.

This is my first contributions, I'm not sure about the PR rules, and I'm not a python dev. Let me know if I need to make any changes. The security headers were copied from the Facebook extractor. I removed the /guide test as that instagram feature no longer exist.

@mikf
Copy link
Owner

mikf commented Apr 18, 2025

Can /share/ URLs only redirect to individual posts or is it possible for them to redirect to other things as well, like a profile URL?

@DjofPlusPlus
Copy link
Contributor Author

So I went to test this, and they seem to have reverted this feature in the last few days. The app no longer gives any /share/ URL when copying links or sharing posts. My logs still show some until last Monday. I guess we can close the PR.

- added Sec-Fetch* headers for proper redirect
- fixed formatting
- restore 'guide' test
- integrate in PostExtractor code
@mikf mikf force-pushed the djof_fix_instagram branch from 2084b83 to e6f4dcf Compare April 19, 2025 16:21
@mikf mikf merged commit 4b11c72 into mikf:master Apr 19, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants