24 lines
882 B
Python
24 lines
882 B
Python
#!/usr/bin/python
|
|
import requests
|
|
|
|
UUID = input("copy-paste the serial of the game to download updates for: ")
|
|
updates = f"https://a0.ww.np.dl.playstation.net/tpl/np/{UUID}/{UUID}-ver.xml"
|
|
xml = requests.get(updates, verify=False).text
|
|
linkarray = []
|
|
while True:
|
|
start = xml.find('url="') + 5
|
|
end = xml.find('.pkg"') + 4
|
|
if start == 4 or end == 3:
|
|
break
|
|
pkg = xml[start:end]
|
|
linkarray.append(pkg)
|
|
xml = xml[end:]
|
|
print(str(len(linkarray)) + " updates found")
|
|
for item in linkarray:
|
|
name = str(linkarray.index(item) + 1) + ".pkg"
|
|
with requests.get(item,stream = True, verify=False) as r:
|
|
r.raise_for_status()
|
|
with open("./updates/" +name, "wb") as f:
|
|
for chunk in r.iter_content(chunk_size=8192):
|
|
f.write(chunk)
|
|
print("finished: " + str(linkarray.index(item) + 1) + " of "+ str(len(linkarray)))
|