Last active
September 14, 2023 05:21
-
-
Save unresolvedsymbol/23921cbdddb0a527fe64a829ed88e0a3 to your computer and use it in GitHub Desktop.
PKGi-PS3 database generator (via NPS)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import csv, codecs, urllib.request | |
print('Database generator by Void') | |
host = codecs.decode(b'aHR0cHM6Ly9ub3BheXN0YXRpb24uY29tL3Rzdg==', 'base64').decode('ascii') | |
content = { | |
"unknown" : "", | |
"games": "PS3_GAMES.tsv", | |
"DLC": "PS3_DLCS.tsv", | |
"themes": "PS3_THEMES.tsv", | |
"avatars": "PS3_AVATARS.tsv", | |
"demos": "" | |
} | |
newlist = [] | |
for contype in content: | |
url = content[contype] | |
if not url: | |
continue | |
print('Retrieving {}...'.format(contype)) | |
url = host + '/' + url | |
contype = str(list(content.keys()).index(contype)) | |
req = urllib.request.Request(url, data=None, headers={'User-Agent': 'eye01'}) | |
with urllib.request.urlopen(req) as csvfile: | |
listreader = csv.reader(codecs.iterdecode(csvfile, 'utf-8'), delimiter=' ', quotechar='"') | |
csvfile.readline() # Skip first line | |
for row in listreader: | |
if row[3] == 'MISSING': | |
continue | |
newrow = [] | |
newrow.append(row[5]) # Content ID | |
newrow.append(contype) # Flags (unused) | |
newrow.append(row[2]) # Name | |
newrow.append('') # Description (unused) | |
newrow.append(row[4] if row[4] != 'MISSING' else '') # RAP file in HEX (16 bytes) | |
newrow.append(row[3]) # PKG Download Link | |
newrow.append(row[8]) # File size | |
newrow.append(row[9]) # Checksum | |
newlist.append(newrow) | |
with open('pkgi.txt', 'w', newline='', encoding="utf-8") as csvfile: | |
listwriter = csv.writer(csvfile, delimiter=',', | |
quotechar='"', quoting=csv.QUOTE_MINIMAL) | |
print('Saving pkgi.txt...') | |
for newrow in newlist: | |
listwriter.writerow(newrow) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment