Last active
August 19, 2018 12:50
-
-
Save 5S/dcc428082ddbc662eac4138ff0fdef95 to your computer and use it in GitHub Desktop.
starlight.kirara.ca から現在の res_ver を拾ってきて最新版の manifest を落とすやつ
This file contains hidden or 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 | |
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): | |
response = urllib2.urlopen("{base}/dl/{res_ver}/manifests/Android_AHigh_SHigh".format(base=BASEURL, res_ver=res_ver,)) | |
data = response.read() | |
return data | |
def unlz4(data): | |
fd = StringIO.StringIO(data) | |
magic, uncomp, comp, unk = struct.unpack("<IIII", fd.read(16)) | |
d = lz4.loads(struct.pack("<I", uncomp) + fd.read()) | |
assert len(d) == uncomp | |
return d | |
def write_file(dest, data): | |
with open(dest, "w") 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