import tarfile, json, zlib
tar_gz_path = 'userGachaData_xxxxxx_enc.tar.gz'
with tarfile.open(tar_gz_path, 'r:gz') as tar_file:
for member in tar_file:
if member.isfile():
print(member.name)
file = tar_file.extractfile(member)
print(json.loads(zlib.decompress(file.read())))
break
import tarfile, json, zlib
from tqdm.notebook import tqdm
gachaTotalNum = 0
tar_gz_path = 'userGachaData_xxxxxx_enc.tar.gz'
with tarfile.open(tar_gz_path, 'r:gz') as tar_file:
for member in tqdm(tar_file, total=len(tar_file.getmembers())):
if member.isfile():
file = tar_file.extractfile(member)
gachaData = json.loads(zlib.decompress(file.read()))
for ts in gachaData:
if 'c' in gachaData[ts]:
gachaTotalNum += len(gachaData[ts]['c'])
print(gachaTotalNum)