sssekai icon indicating copy to clipboard operation
sssekai copied to clipboard

The code of dumping master data of tw server is wrong

Open 269Seahorse opened this issue 3 months ago • 2 comments

In sssekai/entrypoint/abcache.py, the code of dumping master data:

 if args.dump_master_data:
        if config.app_region in REGION_JP_EN:
            assert (
                try_auth()
            ), "Cannot dump master data without valid auth info in EN/JP servers."
        cache.update_client_headers()
        master_data_path = os.path.expanduser(args.dump_master_data)
        os.makedirs(master_data_path, exist_ok=True)
        logger.info("Dumping master data to %s", master_data_path)
        for url in tqdm(cache.SEKAI_API_MASTER_SUITE_URLS, unit="file"):
            resp = cache.request_packed("GET", url)
            dump_dict_by_keys(
                cache.response_to_dict(resp), master_data_path, args.keep_compact
            )
        return

where SEKAI_API_MASTER_SUITE_URLS leads to the file sssekai/abcache/__init.py__:

def SEKAI_API_MASTER_SUITE_URLS(self):
        match self.config.app_region:
            # code for en jp
        if self.config.app_region in REGION_ROW:
            self.raise_for_auth()
            return f"{self.SEKAI_AB_ROW_CDN}/{self.SEKAI_AB_ROW_PATH}/master-data-{self.database.sekai_user_auth_data.cdnVersion}.info"
        else:
            raise NotImplementedError

the self.raise_for_auth() isn't needed since you can download the master data withput any authentication. Also, the url for the master data is https://lf21-mkovscdn-sg.bytedgame.com/obj/sf-game-alisg/gdl_app_5245/MasterData/60001/master-data-{cdnVersion}}.info for tw.

Didn't verify for other servers though.

Also in sssekai/entrypoint/abcache.py, in for url in tqdm(cache.SEKAI_API_MASTER_SUITE_URLS, unit="file"):, it expects a list not a string, so SEKAI_API_MASTER_SUITE_URLS should return a list including the url instead of only the url.

269Seahorse avatar Sep 17 '25 16:09 269Seahorse

the self.raise_for_auth() isn't needed since you can download the master data withput any authentication. Also, the url for the master data is https://lf21-mkovscdn-sg.bytedgame.com/obj/sf-game-alisg/gdl_app_5245/MasterData/60001/master-data-{cdnVersion}}.info for tw.

Last time I've checked - cdnVersion is only contained in SEKAI_API_USER_AUTH payload, and that needs auth. I suppose one can also hardcode this value since that doesn't seem to change all that much.

The URL format seem to have changed as well. I'll test on these once I have the time.

Also in sssekai/entrypoint/abcache.py, in for url in tqdm(cache.SEKAI_API_MASTER_SUITE_URLS, unit="file"):, it expects a list not a string, so SEKAI_API_MASTER_SUITE_URLS should return a list including the url instead of only the url.

You're right, the return type has been bogus - this should be fixed in https://github.com/mos9527/sssekai/commit/5ead80be7f1dc80a736bead28b7d076220f56550

mos9527 avatar Sep 18 '25 00:09 mos9527

You're correct. I forgot that I have to retrieve the cdn version by auth.

269Seahorse avatar Sep 18 '25 02:09 269Seahorse