Skip to content

Instantly share code, notes, and snippets.

@Zer0xFF
Last active October 13, 2023 13:58
Show Gist options
  • Save Zer0xFF/2cc7687d557314e01c7c157195314f7f to your computer and use it in GitHub Desktop.
Save Zer0xFF/2cc7687d557314e01c7c157195314f7f to your computer and use it in GitHub Desktop.
you'd need to download you're entitlements 1st
so login to PSN web store
then open this link https://store.playstation.com/kamaji/api/chihiro/00_09_000/gateway/store/v1/users/me/internal_entitlements?start=0&size=800&fields=game_meta,drm_def
save as JSON, i called them EU.json and USA.json as per region, then run through the script, not if you only have 1 account or of different region, adjust the script accordingly
#!/usr/bin/env python
import json
def get_plat(node):
if('platformIds' in node):
platformIds = node['platformIds']
if(platformIds == 2147483648 and node['downloadType'] == 0):
return 'PS3'
elif(platformIds == 2281701376):
return 'PSV'
elif(platformIds == 4161798144 or platformIds == 1880096768 or platformIds == 4027580416):
# Games VS Demos vs Demos/Themes
return 'PSP'
elif(platformIds == 2174746624 or platformIds == 2147483648 or platformIds == 2510487552 or platformIds == 3154313216):
# Videos HD VS SD ?
return None
return 'UNK'
def parse_internal_entitlement():
files = ['EU.json', 'USA.json']
total = {'PSP': {'count': {}}, 'PSV': {'count': {}}, 'PS3': {'count': {}}, 'PS4': {'count': {}}, 'UNK': {'count': {}}}
id = {}
for filename in files:
with open(filename, 'r') as f:
y = json.load(f)
total['PS4']['count'][filename] = 0
total['PS3']['count'][filename] = 0
total['PSV']['count'][filename] = 0
total['PSP']['count'][filename] = 0
total['UNK']['count'][filename] = 0
for ele in y['entitlements']:
if 'entitlement_attributes' in ele:
total['PS4']['count'][filename] += 1
else:
if('drm_def' in ele):
if('drmContents' in ele['drm_def']):
for ele2 in ele['drm_def']['drmContents']:
plat = get_plat(ele2)
if(plat):
total[plat]['count'][filename] += 1
total[plat][ele['id']] = 0
else:
total['UNK']['count'][filename] += 1
total['UNK'][ele['id']] = 0
# print(json.dumps(ele, indent=4))
else:
total['UNK']['count'][filename] += 1
# print(json.dumps(ele, indent=4))
print("{}: PS3: {} - PS4: {} - PSV: {} - MISC: {}".format(filename, total['PS3']['count'][filename], total['PS4']['count'][filename], total['PSV']['count'][filename], total['UNK']['count'][filename]))
print("TOTAL: PS3: {} - PS4: {} - PSV: {} - MISC: {}".format(sum(total['PS3']['count'].values()), sum(total['PS4']['count'].values()), sum(total['PSV']['count'].values()), sum(total['UNK']['count'].values())))
return total
if __name__ == "__main__":
parse_internal_entitlement()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment