Instagram used to expose open data as json under the endpoint https://www.instagram.com/<username>/?__a=1
. This changed over night, the endpoint is not available anymore. What is the new endpoint or what could be an alternative to this?
Thanks in advance!
This endpoint still works but you must have valid cookies from a currently logged in session.
In case you're seeking for the regex:
<script type="text\/javascript">window[.]_sharedData = {[\s\S]*};<\/script>
The endpoint does not exist anymore. Facebook is restricting APIs because of scandals. The data is still there of course, Instagram's frontend needs it, so the alternative right now is to scrape the page and find the json data there. Here is how I do it:
https://www.instagram.com/<username>
.script
tag which text's starts withwindow._sharedData =
. You can use regular expressions or a scraping library for this.;
at the end) is the json data you want.Here is an example using Python: