-
-
Save kurumigi/426c58d140a1b666c688aa7b9dae78f6 to your computer and use it in GitHub Desktop.
starlight.kirara.ca から現在の res_ver を拾ってきて最新版の manifest を落とすやつ
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import lz4.block | |
import re | |
import StringIO | |
import struct | |
import urllib2 | |
BASEURL = "http://storage.game.starlight-stage.jp" | |
def fetch_res_ver(): | |
response = urllib2.urlopen("https://starlight.kirara.ca/") | |
html = response.read() | |
pattern = r"truth version (.*)," | |
match = re.search(pattern, html) | |
return match.group(1) | |
def fetch_manifest(res_ver): | |
request = urllib2.Request("{base}/dl/{res_ver}/manifests/Android_AHigh_SHigh".format(base=BASEURL, res_ver=res_ver,)) | |
request.add_header('User-Agent', "Dalvik/1.6.0 (Linux; U; Android 4.4.4; GT-P5210 Build/KTU84P)") | |
request.add_header('X-Unity-Version', "5.4.5p1") | |
response = urllib2.urlopen(request) | |
data = response.read() | |
return data | |
def unlz4(data): | |
fd = StringIO.StringIO(data) | |
magic, uncomp, comp, unk = struct.unpack("<IIII", fd.read(16)) | |
d = lz4.block.decompress(struct.pack("<I", uncomp) + fd.read()) | |
assert len(d) == uncomp | |
return d | |
def write_file(dest, data): | |
with open(dest, "wb") as fd: | |
fd.write(data) | |
res_ver = fetch_res_ver() | |
print "res_ver: " + res_ver | |
packed = fetch_manifest(res_ver) | |
unpacked = unlz4(packed) | |
write_file("{res_ver}_Android_AHigh_SHigh".format(res_ver=res_ver,), unpacked) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment