Compare commits

..

No commits in common. "765e398010d467de9dfc0c5715c76629c26550c3" and "509d44f3a4f5f1a0a8dc6e7f4f075d3ba29eb409" have entirely different histories.

View file

@ -12,41 +12,14 @@ def split_array(arr, size):
def try_to_get_carousel(array, post):
try:
node = vars(post)['_node']
if 'edge_sidecar_to_children' in node:
try:
urls = list(map(lambda arr: arr['node']['display_url'], node['edge_sidecar_to_children']['edges']))
print(Fore.GREEN + "🎠 > Found carousel!")
print(Style.RESET_ALL)
print(datetime.datetime.now())
return urls
except Exception as e:
print(Fore.RED + "🎠💥 > No carousel :( \n", e)
print(Style.RESET_ALL)
print(datetime.datetime.now())
return array
else:
print(Fore.YELLOW + "🎠💥 > No carousel\n")
# We can also have video in a separate key
if 'is_video' in node and node ['is_video']:
try:
urls = [node['video_url']]
print(Fore.GREEN + "🎞 > Found video!")
print(Style.RESET_ALL)
print(datetime.datetime.now())
return urls
except Exception as e:
print(Fore.RED + "🎞💥 > No video :( \n", e)
print(Style.RESET_ALL)
print(datetime.datetime.now())
return array
else:
print(Fore.YELLOW + "🎠💥 > No video\n")
urls = list(map(lambda arr: arr['node']['display_url'], vars(post)['_node']['edge_sidecar_to_children']['edges']))
return urls
print(Fore.GREEN + "🎠 > Found carousel!")
print(Style.RESET_ALL)
print(datetime.datetime.now())
except Exception as e:
print(Fore.RED + "😱💥 > No node :( \n", e)
print(Fore.RED + "🎠💥 > No carousel :( \n", e)
print(Style.RESET_ALL)
print(datetime.datetime.now())
return array
return array