Skip to content

Instantly share code, notes, and snippets.

@Aareon
Last active January 10, 2017 09:03
Show Gist options
  • Save Aareon/aa3ea6a127b6b143147bcb67bd247c4a to your computer and use it in GitHub Desktop.
Save Aareon/aa3ea6a127b6b143147bcb67bd247c4a to your computer and use it in GitHub Desktop.
Downloads Endless Frontier Discord Server icons, displays progress, saves them to ./icons
import os,requests
icons = requests.get('http://pastebin.com/raw/b5fdkNp9').content.splitlines()
if not os.path.exists('./icons'):
print("Creating ./icons")
os.mkdir('./icons')
for i, icon in enumerate(icons):
##print('{0}\r'.format("Downloaded: "+str(i+1)+"/"+str(len(icons))+" images")), ##Python 2.7
##print("Downloaded: "+str(i+1)+"/"+str(len(icons))+" images", end="\r"), ##Python 3.x
img_data = requests.get(icons[i]).content
with open("./icons/icon"+str(i)+".png", 'wb') as handler:
handler.write(img_data)
@Aareon
Copy link
Author

Aareon commented Jan 10, 2017

Optimized to the best of my ability to compile and run in Python 3.
Uncomment line 7 for Python 2.7, line 8 for Python 3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment