Created
December 23, 2020 20:16
-
-
Save oliver-batey/f2f5feeb59cf40efc1dc0498d6145830 to your computer and use it in GitHub Desktop.
Download instagram images
This file contains 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
#Scrape profile and get recent posts | |
natgeo = Profile('natgeo') | |
natgeo.scrape() | |
recents = natgeo.get_recent_posts() | |
#Filter list to separate images from videos | |
recent_photos = [post for post in recents if not post.is_video] | |
#Save photos in a loop | |
for i, post in enumerate(recent_photos): | |
savename = 'natgeo_image_{}.png'.format(i) | |
post.download(savename) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment