I made a request to Instagram v1 API it gives back the response in JSON like this The JSON data on pastebin.com
I noticed that I can get the number of IDs and the IDs by :
IDs = response['reels'][ide]["media_ids"]
count=response['reels'][ide]["media_count"]
Assuming the "media URLs" are the values associated with a key "url" then you can just do this:
import json
def print_url(jdata):
if isinstance(jdata, list):
for v in jdata:
print_url(v)
elif isinstance(jdata, dict):
if (url := jdata.get('url')):
print(url)
else:
print_url(list(jdata.values()))
with open('instagram.json', encoding='utf-8') as data:
print_url(json.load(data))