Created
March 8, 2018 16:19
-
-
Save Steboss/34d109ba95b63062e69bdab58ad806cf to your computer and use it in GitHub Desktop.
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
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