44 lines
1.4 KiB
Python
44 lines
1.4 KiB
Python
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()
|
|
|
|
if j['Products']:
|
|
return j['Products'][0]['LocalizedProperties'][0]['ProductTitle']
|
|
else:
|
|
return 'Unknown Title'
|
|
else:
|
|
return 'Error'
|
|
|
|
|
|
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')
|
|
break
|
|
|
|
|
|
if __name__ == '__main__':
|
|
colorama.init()
|
|
|
|
main()
|