'How to scrape similar/related accounts from instagram in python?

I am trying to scrape accounts which are similar/related to a given account in instagram. Querying URLS: https://www.instagram.com/{username}/?_a=1 doesn't provide this information.

Any help is appreciated.



Solution 1:[1]

If you want to list all followers and followings of a user, what I guess based of your question. aandergr made answered that in this question. If not let me know how you define "similar"

Solution 2:[2]

A way to get this is from link: https://www.instagram.com/{username} and info comes as "edge_related_profiles":{"edges":[{"node":{".....}}]}

And to get this, we need to be authenticated to the site as a guest and should NOT be logged in. I am still investigating the reason of this but yes workaround is possible.

Update 04/18/2022 => This queryhash works fine to pull suggested/similar accounts: https://www.instagram.com/graphql/query/?query_hash=7c16654f22c819fb63d1183034a5162f

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 aLittleOtaku
Solution 2