This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
with open('posts.json', 'r') as f: | |
arr = json.loads(f.read()) # load json data from previous step | |
locations = [] | |
for item in arr: | |
shortcode = item['shortcode'] | |
url = "https://www.instagram.com/p/{0}/?__a=1".format(shortcode) | |
r = requests.get(url) | |
data = json.loads(r.text) | |
try: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import time | |
import json | |
arr = [] | |
end_cursor = '' # empty for the 1st page | |
tag = 'russia' # your tag | |
page_count = 5 # desired number of pages | |
for i in range(0, page_count): | |
url = "https://www.instagram.com/explore/tags/{0}/?__a=1&max_id={1}".format(tag, end_cursor) | |
r = requests.get(url) |