Advertisement
Peaser

skindl

Aug 16th, 2014
327
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.97 KB | None | 0 0
  1. import urllib, os
  2. version = 1.0
  3. nc = lambda s: (s,s.lower(),s.capitalize())
  4. print("Minecraft Skin Downloader - Version %s" % str(version))
  5. print("Current Download Path: %s" % os.getcwd())
  6. print("Press Ctrl-C to quit; Type !!HELP for information")
  7. print("="*80)
  8.  
  9. run = True
  10. try:
  11.     while run:
  12.         try:
  13.             req = raw_input("Minecraft Username: ")
  14.             if req == "!!HELP":
  15.                 print("#"*80)
  16.                 print("-Minecraft Skin Downloader")
  17.                 print("-Version %s" % str(version))
  18.                 print("-Type any *valid* Minecraft Username at the prompt.")
  19.                 print("-Usernames are case sensitive.")
  20.                 print("-To try to fix this, Minecraft Skin Downloader will attempt to download the name 3 times with different capitalizations.")
  21.                 print("-If it fails all 3 times, Either: The user does not exist or You typed the name wrong.")
  22.                 print("-Skin is downloaded and saved as a .png in the same directory as this program's executable/.py file.")
  23.                 print("Pastebin: http://pastebin.com/78mrj1U2\n")
  24.                 print("#"*80)
  25.             else:
  26.                 print("Attempting to download %s's skin..." % req)
  27.                 formatted_names = nc(req)
  28.                 for name in formatted_names:
  29.                     try:
  30.                         print("Trying: %s" % name)
  31.                         url = "https://s3.amazonaws.com/MinecraftSkins/%s.png" % name
  32.                         content = urllib.urlopen(url).read()
  33.                         if "AccessDenied" in content:
  34.                             raise Exception, "Error: The username '%s' is not valid." % name
  35.                         urllib.urlretrieve(url, name+'.png')
  36.                         print("Download Successful.")
  37.                     except Exception, e:
  38.                         print e
  39.         except Exception, e:
  40.             print(e)
  41.             run = False
  42. except Exception, e:
  43.     print(e)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement