Ailyth commited on
Commit
ebc7c7c
·
verified ·
1 Parent(s): d502ba0

Delete xml_scan.py

Browse files
Files changed (1) hide show
  1. xml_scan.py +0 -44
xml_scan.py DELETED
@@ -1,44 +0,0 @@
1
- import hmac
2
- import hashlib
3
- import binascii
4
- import requests
5
- import xml.etree.ElementTree as ET
6
- from tqdm import tqdm
7
- import urllib3
8
-
9
- urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
10
-
11
- def generate_url(GameID):
12
- byte_key = binascii.unhexlify("AD62E37F905E06BC19593142281C112CEC0E7EC3E97EFDCAEFCDBAAFA6378D84")
13
- hash = hmac.new(byte_key, ("np_" + GameID).encode('utf-8'), digestmod=hashlib.sha256)
14
- hash = hash.hexdigest()
15
- url = f"https://gs-sec.ww.np.dl.playstation.net/plo/np/{GameID}/{hash}/{GameID}-ver.xml"
16
- return url
17
-
18
- for number in tqdm(range(1, 45000)):
19
- GameID = f"CUSA{number:05}"
20
- url = generate_url(GameID)
21
-
22
- try:
23
-
24
- response = requests.get(url,verify=False)
25
- response.raise_for_status()
26
- xml_content = response.content
27
-
28
- root = ET.fromstring(xml_content)
29
-
30
- title_id = root.attrib["titleid"]
31
- title = root.find(".//title").text
32
- version = root.find(".//package").attrib["version"]
33
- #content_id = root.find(".//package").attrib["content_id"]
34
-
35
-
36
- with open("extracted_info.txt", "w", encoding="utf-8") as info_file:
37
- info_file.write(f"{title_id},{title},{version}\n")
38
-
39
- print(f"\r{GameID}:{title} - COMPLETE", end="")
40
- except (requests.exceptions.RequestException, ET.ParseError) as e:
41
- print(f"\r{GameID} - Game not exist", end="")
42
- continue
43
-
44
- print("Extraction and writing completed!")