thekin

Pive.py - Simple Python File Downloader

Mar 9th, 2019
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.33 KB | None | 0 0
  1. import sys
  2. import requests
  3.  
  4. url = sys.argv[1]
  5.  
  6. while url[-1] == "/":
  7.     i = 0
  8.     new_url = ""
  9.     for x in url:
  10.         i += 1
  11.         if i != len(url):
  12.             new_url += x
  13.     url = new_url
  14.  
  15. name = url.split("/")[url.count("/")]
  16.  
  17. r = requests.get(url)
  18.  
  19. print("Downloading {}".format(name))
  20.  
  21. with open(name, "w") as fd:
  22.     fd.writelines(r)
Add Comment
Please, Sign In to add comment