Skip to content

Instantly share code, notes, and snippets.

@WorkingRobot
Created March 5, 2022 01:05
Show Gist options
  • Save WorkingRobot/21aa0a32115686b90e8c1f50b0799daf to your computer and use it in GitHub Desktop.
Save WorkingRobot/21aa0a32115686b90e8c1f50b0799daf to your computer and use it in GitHub Desktop.
import requests, gzip, os
import xml.etree.ElementTree as ET
# Download from https://github.com/EpicGames/UnrealEngine/master/Engine/Build/Commit.gitdeps.xml and store it to the current directory
# Downloaded files will be put in current directory
manifest = ET.parse("Commit.gitdeps.xml").getroot()
files = []
for file in manifest.find("Files"):
if "Oodle" in file.attrib["Name"] and "Sdk" in file.attrib["Name"]:
files.append(file)
blobs = []
for blob in manifest.find("Blobs"):
for file in files:
if file.attrib["Hash"] == blob.attrib["Hash"]:
blobs.append(blob)
break
packs = []
for pack in manifest.find("Packs"):
for blob in blobs:
if blob.attrib["PackHash"] == pack.attrib["Hash"]:
packs.append(pack)
break
for pack in packs:
packData = gzip.decompress(requests.get("%s/%s/%s" % (manifest.attrib["BaseUrl"], pack.attrib["RemotePath"], pack.attrib["Hash"])).content)
for blob in blobs:
if blob.attrib["PackHash"] == pack.attrib["Hash"]:
Size = int(blob.attrib["Size"])
Offset = int(blob.attrib["PackOffset"])
FileName = None
for file in files:
if file.attrib["Hash"] == blob.attrib["Hash"]:
FileName = file.attrib["Name"]
break
if not FileName:
continue
print(FileName)
os.makedirs(os.path.dirname(FileName), exist_ok=True)
with open(FileName, "wb") as f:
f.write(packData[Offset:Offset + Size])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment