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

Instagram changed code? Script no longer working? #11

Closed
royjor2016 opened this issue Dec 8, 2020 · 8 comments · Fixed by #12
Closed

Instagram changed code? Script no longer working? #11

royjor2016 opened this issue Dec 8, 2020 · 8 comments · Fixed by #12
Assignees
Labels
bug Something isn't working

Comments

@royjor2016
Copy link

It seems IG has changed their codes such that this script fails to fetch contents.

Looking at my execution logs, I think it started around noon, 7 Dec, UTC.

I thought it was cookie problem but now I cannot even reproduce the steps to get the "query hash" string.

@royjor2016
Copy link
Author

Running test pipeline:

Dec 8, 2020, 3:59:38 PM
Info
Dec 08, 2020
Dec 8, 2020, 3:59:39 PM
Info
{"data":{"reels_media":[]},"status":"ok"}
Dec 8, 2020, 3:59:39 PM
Info
Number of URL(s) from @16278726: 0
Dec 8, 2020, 3:59:39 PM
Info
{"data":{"reels_media":[]},"status":"ok"}
Dec 8, 2020, 3:59:39 PM
Info
Number of URL(s) from @528817151: 0
Dec 8, 2020, 3:59:39 PM
Info
{"data":{"reels_media":[]},"status":"ok"}
Dec 8, 2020, 3:59:39 PM
Info
Number of URL(s) from @1112881921: 0
Dec 8, 2020, 3:59:40 PM
Info
Failed to fetch data from the test accounts!!!

@chriskyfung chriskyfung added bug Something isn't working help wanted Extra attention is needed labels Dec 8, 2020
@chriskyfung chriskyfung pinned this issue Dec 8, 2020
@chriskyfung
Copy link
Owner

chriskyfung commented Dec 8, 2020

The Endpoint has changed to https://i.instagram.com/api/v1/feed/reels_media/?reel_ids=xxxxxxxxx

But I have no ideas about what the parameter reel_ids stands for.

@chriskyfung
Copy link
Owner

OK. reel_ids is the Instagram User ID that can be looked up from https://codeofaninja.com/tools/find-instagram-user-id/

But it returns {"message": "useragent mismatch", "status": "fail"} when using a web browser to request the API directly.

There are two new variables, namely, x-ig-app-id and x-ig-www-claim in the header if I view the stories from www.instagram.com. I have to explore whether they are related to the useragent.

chriskyfung pushed a commit that referenced this issue Dec 8, 2020
+ Changed query URL to `https://i.instagram.com/api/v1/feed/reels_media/...`
+ Added two new variables, namely, `x-ig-app-id` and `x-ig-www-claim`
+ Added more header details
+ Rename `myFunction()` to `__main__()`
chriskyfung pushed a commit that referenced this issue Dec 8, 2020
@chriskyfung
Copy link
Owner

@royjor2016

I've updated the code. Could you please test the branch NewEndpoint#11 and see if it works? Thanks!

@royjor2016
Copy link
Author

@chriskyfung TypeError: Cannot read property 'reels_media' of undefined (line 67, file "code")

my line 67
var items = data.reels_media[0].items;

@royjor2016
Copy link
Author

i think it's because JSON changed.

older json data started like this

{"data":{"reels_media":[{"__typename":"GraphReel","id":"xxxxxxx","latest_reel_media":xxxxxxxxxxxx,"can_reply":true,"owner":

now it starts like this

{"reels": {"xxxxxxx": {"id": xxxxxxxxxx, "latest_reel_media":

@chriskyfung
Copy link
Owner

Please check the following commit.

008ebd6

@royjor2016
Copy link
Author

yes it's working smoothly now.
thanks a lot for the quick fixes!

@chriskyfung chriskyfung removed the help wanted Extra attention is needed label Dec 12, 2020
chriskyfung pushed a commit that referenced this issue Dec 17, 2020
@chriskyfung chriskyfung unpinned this issue Feb 28, 2021
chriskyfung added a commit that referenced this issue Jun 28, 2021
+ Changed query URL to `https://i.instagram.com/api/v1/feed/reels_media/...`
+ Added two new variables, namely, `x-ig-app-id` and `x-ig-www-claim`
+ Added more header details
+ Rename `myFunction()` to `__main__()`
chriskyfung added a commit that referenced this issue Jun 28, 2021
chriskyfung added a commit that referenced this issue Jun 28, 2021
@ghost ghost mentioned this issue Dec 19, 2021
@chriskyfung chriskyfung self-assigned this Dec 5, 2023
@chriskyfung chriskyfung modified the milestones: Alpha, Library v8 Dec 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants