Initial release.

This commit is contained in:
Yuuki Chan 2024-11-14 17:18:52 +09:00
parent a4b5d3ee91
commit 03d18d45e2
4 changed files with 42 additions and 0 deletions

3
.gitignore vendored
View file

@ -162,3 +162,6 @@ cython_debug/
# option (not recommended) you can uncomment the following to ignore the entire idea folder. # option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/ #.idea/
# Clips
Clips/*
!Clips/placeholder

0
Clips/placeholder Normal file
View file

BIN
requirements.txt Normal file

Binary file not shown.

39
run.py Normal file
View file

@ -0,0 +1,39 @@
import glob
import json
from base64 import b64decode as b64d
import colorama
import requests
from xmltodict import parse as xparse
licenses = [_ for _ in glob.glob(r'.\Clips\[!placeholder]*')]
uri = 'https://displaycatalog.mp.microsoft.com/v7.0/products?bigIds={}&market=US&languages=en-US,neutral&MS-CV=DGU1mcuYo0WMMp+F.1'
def get_game_name(pid: str) -> str:
req = requests.get(uri.format(pid))
if req.status_code == 200:
j = req.json()
return j['Products'][0]['LocalizedProperties'][0]['ProductTitle']
else:
return 'Unknown Title'
def main():
for lic in licenses:
clip = lic[lic.rfind('\\') + 1:]
data = json.loads(json.dumps(xparse(open(lic, 'r').read()), indent=4))
signed_lic = json.loads(json.dumps(xparse(b64d(data['License']['SignedLicense']).decode())))
custom_policy = json.loads(b64d(signed_lic['SignedLicense']['SVLicense']['CustomPolicies'].encode()).decode())
content_id = custom_policy['packages'][0]['packageIdentifier']
product_id = custom_policy['packages'][0]['productId']
game = get_game_name(product_id)
print(f'\033[91m{clip}\033[97m is for product: \033[91m{game}\033[97m ContentID: \033[91m{content_id}\033[99m')
if __name__ == '__main__':
colorama.init()
main()