Last active
January 24, 2023 20:03
-
-
Save pxdl/ace6325154fac10c9211ac1cf3cfab85 to your computer and use it in GitHub Desktop.
Converts the NoPayStation TSV for PS3 Games to pkgi-ps3 format
This file contains 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
import csv | |
import urllib.request | |
url = "http://nopaystation.com/tsv/PS3_GAMES.tsv" | |
print('Downloading PS3_GAMES.tsv...') | |
urllib.request.urlretrieve(url, 'PS3_GAMES.tsv') | |
newlist = [] | |
with open('PS3_GAMES.tsv', newline='', encoding="utf8") as csvfile: | |
listreader = csv.reader(csvfile, delimiter=' ', quotechar='"') | |
csvfile.readline() # Skip first line | |
print("Rearranging list...") | |
for row in listreader: | |
newrow = [] | |
newrow.append(row[5]) # Content ID | |
newrow.append('0') # Flags (unused) | |
newrow.append(row[2]) # Name | |
newrow.append('') # Description (unused) | |
newrow.append('') # RAP file in HEX (16 bytes) | |
newrow.append(row[3]) # PKG Download Link | |
newrow.append(row[8]) # Filesize | |
newrow.append(row[9]) # Checksum | |
newlist.append(newrow) | |
with open('pkgi.txt', 'w', newline='', encoding="utf8") as csvfile: | |
listwriter = csv.writer(csvfile, delimiter=',', | |
quotechar='"', quoting=csv.QUOTE_MINIMAL) | |
print('Saving pkgi.txt...') | |
for newrow in newlist: | |
listwriter.writerow(newrow) |
Here's the version of the script with @ChronosWasTaken's suggested edit:
import csv
import urllib.request
url = "http://nopaystation.com/tsv/PS3_GAMES.tsv"
print('Downloading PS3_GAMES.tsv...')
req = urllib.request.Request(url, data=None, headers={'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.114 Safari/537.36'})
with open('PS3_GAMES.tsv', 'wb') as file:
file.write(urllib.request.urlopen(req).read())
newlist = []
with open('PS3_GAMES.tsv', newline='', encoding="utf8") as csvfile:
listreader = csv.reader(csvfile, delimiter=' ', quotechar='"')
csvfile.readline() # Skip first line
print("Rearranging list...")
for row in listreader:
newrow = []
newrow.append(row[5]) # Content ID
newrow.append('0') # Flags (unused)
newrow.append(row[2]) # Name
newrow.append('') # Description (unused)
newrow.append('') # RAP file in HEX (16 bytes)
newrow.append(row[3]) # PKG Download Link
newrow.append(row[8]) # Filesize
newrow.append(row[9]) # Checksum
newlist.append(newrow)
with open('pkgi.txt', 'w', newline='', encoding="utf8") 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
wdmycloud only has python 2, and 3(or most anything) is a pita to install on it.
could someone try to convert this to python 2.7?
i tried to use 3to2 from here
https://pypi.org/project/3to2/
but i had to build it in 2.7, and i'm not sure if it worked.
i got a lot of command not found errors.