Skip to content

Instantly share code, notes, and snippets.

@Steboss
Created March 8, 2018 16:19
Show Gist options
  • Save Steboss/34d109ba95b63062e69bdab58ad806cf to your computer and use it in GitHub Desktop.
Save Steboss/34d109ba95b63062e69bdab58ad806cf to your computer and use it in GitHub Desktop.
while True:
current_page +=1
#print("Retrieving urls...")
#connect to the url and read all the infor
res = session.get(url,verify=True) #get the url of the user
data = get_shared_data(res)
try:
media = data['entry_data'][page_name][0][section_name]['media']
media_info = data['entry_data'][page_name][0][section_name]['media']["nodes"]
count_photos = 0
for nodes in media_info:
#print(nodes["code"])
shortcodes.append(nodes["code"])
except:
break
if not media['page_info']['has_next_page']:
break
else:
url = '{}?max_id={}'.format(base_url.format(target), media['page_info']["end_cursor"])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment