Format code

This commit is contained in:
Howard Wu 2023-04-11 05:06:10 +08:00
parent fd51bd872b
commit 6649117eeb

View File

@ -45,6 +45,7 @@ class Prop(OrderedDict):
def get(self, key: str) -> str: def get(self, key: str) -> str:
return self[key] return self[key]
logging.captureWarnings(True) logging.captureWarnings(True)
arch = sys.argv[1] arch = sys.argv[1]
@ -97,7 +98,7 @@ for node in doc.getElementsByTagName('ExtendedUpdateInfo')[0].getElementsByTagNa
for node_file in node_files[0].getElementsByTagName('File'): for node_file in node_files[0].getElementsByTagName('File'):
if node_file.hasAttribute('InstallerSpecificIdentifier') and node_file.hasAttribute('FileName'): if node_file.hasAttribute('InstallerSpecificIdentifier') and node_file.hasAttribute('FileName'):
filenames[node.getElementsByTagName('ID')[0].firstChild.nodeValue] = (f"{node_file.attributes['InstallerSpecificIdentifier'].value}_{node_file.attributes['FileName'].value}", filenames[node.getElementsByTagName('ID')[0].firstChild.nodeValue] = (f"{node_file.attributes['InstallerSpecificIdentifier'].value}_{node_file.attributes['FileName'].value}",
node_xml.getElementsByTagName('ExtendedProperties')[0].attributes['PackageIdentityName'].value) node_xml.getElementsByTagName('ExtendedProperties')[0].attributes['PackageIdentityName'].value)
identities = {} identities = {}
for node in doc.getElementsByTagName('NewUpdates')[0].getElementsByTagName('UpdateInfo'): for node in doc.getElementsByTagName('NewUpdates')[0].getElementsByTagName('UpdateInfo'):
@ -105,7 +106,7 @@ for node in doc.getElementsByTagName('NewUpdates')[0].getElementsByTagName('Upda
if not node_xml.getElementsByTagName('SecuredFragment'): if not node_xml.getElementsByTagName('SecuredFragment'):
continue continue
else: else:
id = node.getElementsByTagName('ID')[0].firstChild.nodeValue id = node.getElementsByTagName('ID')[0].firstChild.nodeValue
update_identity = node_xml.getElementsByTagName('UpdateIdentity')[0] update_identity = node_xml.getElementsByTagName('UpdateIdentity')[0]
if id in filenames: if id in filenames:
fileinfo = filenames[id] fileinfo = filenames[id]
@ -121,6 +122,7 @@ if not download_dir.is_dir():
tmpdownlist = open(download_dir/tempScript, 'a') tmpdownlist = open(download_dir/tempScript, 'a')
def send_req(i, v, out_file, out_file_name): def send_req(i, v, out_file, out_file_name):
out = session.post( out = session.post(
'https://fe3.delivery.mp.microsoft.com/ClientWebService/client.asmx/secured', 'https://fe3.delivery.mp.microsoft.com/ClientWebService/client.asmx/secured',
@ -136,6 +138,7 @@ def send_req(i, v, out_file, out_file_name):
tmpdownlist.writelines(f' dir={download_dir}\n') tmpdownlist.writelines(f' dir={download_dir}\n')
tmpdownlist.writelines(f' out={out_file_name}\n') tmpdownlist.writelines(f' out={out_file_name}\n')
threads = [] threads = []
for filename, values in identities.items(): for filename, values in identities.items():
if re.match(f"Microsoft\.UI\.Xaml\..*_{arch}_.*\.appx", filename): if re.match(f"Microsoft\.UI\.Xaml\..*_{arch}_.*\.appx", filename):