In a previous tutorial, we built an Instagram Scraper with Python. This method scrapes meta tags from the post content and these tags had links to the image or video for the post. This method however no longer works. We can however get the same content ( image or video URL ) by appending ?__a=1 to any Instagram post URL. This information is displayed in JSON format. To get the JSON for an Instagram post such as https://www.instagram.com/p/B9X_7yVFt5q, we can use the URL https://www.instagram.com/p/B9X_7yVFt5q/?__a=1
The full source code for scraping an entire Instagram profile is below.