Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python3
- import requests
- import sys
- import re
- def download_package(id, path=""):
- link = "https://thesimsresource.com/ajax.php?c=downloads&a=getdownloadurl&ajax=1&itemid={}&mid=0&lk=0"
- # print(link.format(id))
- res = requests.get(link.format(id)).json()
- dl_link = res['url']
- file = requests.get(dl_link)
- fname = re.findall("filename=\"(.+)\"", file.headers['content-disposition'])[0]
- print(fname)
- with open(path + fname, 'wb') as f:
- f.write(file.content)
- if __name__ == "__main__":
- download_package(sys.argv[1], "dl/")
Advertisement
Add Comment
Please, Sign In to add comment