《恋姬大战 PREMIUM》已在 Fanza 上线。
网址: Now loading...
我找到了配置文件的位置。
我已经上传了配置文件供参考。
网址:https://drive.google.com/file/d/1JKF6lrJ3J80djwT7fGR8JEFg_FivIorh/view?usp=sharing
我想从这个配置文件中下载资源,请问有人可以帮忙吗?
《恋姬大战 PREMIUM》已在 Fanza 上线。
网址: Now loading...
我找到了配置文件的位置。
我已经上传了配置文件供参考。
网址:https://drive.google.com/file/d/1JKF6lrJ3J80djwT7fGR8JEFg_FivIorh/view?usp=sharing
我想从这个配置文件中下载资源,请问有人可以帮忙吗?
import json
import os
import urllib.parse
def parse_config(config_path):
with open(config_path, ‘r’, encoding=‘utf-8’) as f:
data = json.load(f)
uuids = data.get('uuids', [])
paths = data.get('paths', {})
types = data.get('types', [])
extension_map = data.get('extensionMap', {})
versions = data.get('versions', {})
print(f"UUID 总数: {len(uuids)}")
print(f"路径条目数: {len(paths)}")
print(f"资源类型: {types}")
print(f"扩展名映射数量: {len(extension_map)}")
print()
import_versions = {}
native_versions = {}
if 'import' in versions:
iv = versions['import']
for i in range(0, len(iv), 2):
if i + 1 < len(iv):
import_versions[iv[i]] = iv[i + 1]
if 'native' in versions:
nv = versions['native']
for i in range(0, len(nv), 2):
if i + 1 < len(nv):
native_versions[nv[i]] = nv[i + 1]
results = []
for idx_str, path_entry in paths.items():
if isinstance(path_entry, list) and len(path_entry) >= 2:
path_str = path_entry[0]
type_idx = path_entry[1]
idx = int(idx_str)
if idx < len(uuids):
uuid = uuids[idx]
else:
uuid = f"unknown_{idx}"
ext = ""
for ext_name, indices in extension_map.items():
if idx in indices:
ext = ext_name
break
type_name = types[type_idx] if isinstance(type_idx, int) and type_idx < len(types) else "unknown"
import_ver = import_versions.get(idx, '')
native_ver = native_versions.get(idx, '')
results.append({
'index': idx,
'path': path_str,
'uuid': uuid,
'ext': ext,
'type': type_name,
'import_ver': import_ver,
'native_ver': native_ver
})
results.sort(key=lambda x: x['index'])
return results, data
def extract_download_urls(results, base_url=“https://prod-cdn-dmm.koihimetaisen.com/browser/remote/remoteAssets”):
urls =
for item in results:
path = item['path']
uuid = item['uuid']
ext = item['ext']
import_ver = item['import_ver']
native_ver = item['native_ver']
uuid_prefix = uuid[:2]
uuid_encoded = urllib.parse.quote(uuid, safe='')
if ext:
ver = native_ver if native_ver else import_ver
if ver:
url = f"{base_url}/native/{uuid_prefix}/{uuid_encoded}.{ver}{ext}"
else:
url = f"{base_url}/native/{uuid_prefix}/{uuid_encoded}{ext}"
else:
ver = import_ver
if ver:
url = f"{base_url}/import/{uuid_prefix}/{uuid_encoded}.{ver}.json"
else:
url = f"{base_url}/import/{uuid_prefix}/{uuid_encoded}.json"
urls.append({
'path': path,
'url': url,
'uuid': uuid,
'type': 'native' if ext else 'import',
'res_type': item['type']
})
return urls
def main():
config_path = r"f:\DMM系列资源\恋姬\dl\config.7f54e.json"
print("=" * 60)
print("解析 Cocos Creator 资源配置文件")
print("=" * 60)
results, data = parse_config(config_path)
print("=" * 60)
print("前 30 个资源路径示例:")
print("=" * 60)
for item in results[:30]:
print(f"[{item['index']:5d}] {item['path']} ({item['type']})")
print(f" UUID: {item['uuid']}")
if item['ext']:
print(f" Native: {item['native_ver']}{item['ext']}")
else:
print(f" Import: {item['import_ver']}.json")
urls = extract_download_urls(results)
print()
print("=" * 60)
print("前 15 个下载 URL 示例:")
print("=" * 60)
for item in urls[:15]:
print(f"{item['path']} ({item['res_type']})")
print(f" -> {item['url']}")
output_file = r"f:\DMM系列资源\恋姬\resource_urls.txt"
with open(output_file, 'w', encoding='utf-8') as f:
for item in urls:
f.write(f"{item['url']}\n")
output_json = r"f:\DMM系列资源\恋姬\resource_map.json"
with open(output_json, 'w', encoding='utf-8') as f:
json.dump([{
'path': item['path'],
'url': item['url'],
'uuid': item['uuid'],
'type': item['res_type']
} for item in urls], f, ensure_ascii=False, indent=2)
type_count = {}
for item in urls:
t = item['res_type']
type_count[t] = type_count.get(t, 0) + 1
print()
print("=" * 60)
print("资源类型统计:")
print("=" * 60)
for t, c in sorted(type_count.items(), key=lambda x: -x[1]):
print(f" {t}: {c}")
print()
print("=" * 60)
print(f"总计: {len(urls)} 个资源 URL")
print(f"URL 列表已保存到: {output_file}")
print(f"资源映射已保存到: {output_json}")
print("=" * 60)
print()
print("注意: CDN 有访问控制 (403 AccessDenied)")
print("可能需要:")
print(" 1. 从游戏页面访问获取签名 URL")
print(" 2. 特定的认证 token")
print(" 3. 游戏客户端特定的请求头")
if name == “main”:
main()
资源链接还要处理一下
from cocos_downloader.downloader import assetDownloader # pip install git+https://github.com/dewrfe53535/cocos_downloader
import requests
config = {
"downloader_assetroot":'C',
'downloader_savepath' : 'resource/game',
'asset_baseurl':'https://prod-cdn-dmm.koihimetaisen.com/browser/assets',
'downloader_threadnum':64,
'downloader_weburl':''
}
downloader = assetDownloader(config)
firstManifestUrl = 'https://prod-cdn-dmm.koihimetaisen.com/browser/src/settings.ad074.json'
firstManifest = requests.get(firstManifestUrl).json()
downloader.manifestOfmanifestData = {i:v for i,v in firstManifest['assets']['bundleVers'].items() if 'remote' in i}
downloader.remoteUrl = 'https://prod-cdn-dmm.koihimetaisen.com/browser/remote'
downloader.remoteBundles.append('remoteAssets')
downloader.jsurl = '/{typename}/index.{version}.js'
downloader.configurl = '/{typename}/config.{version}.json'
downloader.downloadAllManifest()
downloader.downloadAllFromManifest()
# 下面操作的前置
from cocos_downloader.parser import ManifestJson
for name,jsondata in downloader.manifestData.items():
print(name)
res = ManifestJson(name,jsondata,config)
res.remoteUrl= 'https://prod-cdn-dmm.koihimetaisen.com/browser/remote/'
res.mapExt()
downloader.MTdownloadAndSetimport(res,res.getAllpackDownloadUrl())
downloader.MTdownloadAndSetimport(res, res.getAllINDimportDownloadUrl())
res.setRealPaths()
# 提取静态CG
from cocos_downloader.parser import ManifestJson
import os
import shutil
dst = 'still_img'
for i in res.assetList:
if i.nativeVersion and i.nativeExt and i.realPath:
if 'stillAnim' in i.realPath:
srcpath = downloader.convertUrltoPath(res.convertInfoToUrl('native', i.uuid, i.nativeVersion, i.nativeExt))
if os.path.exists(srcpath):
dstpath = f'{dst}/{i.realPath}{i.nativeExt}'
downloader.mkdir(dstpath)
if os.path.exists(dstpath):
continue
shutil.copy(srcpath,dstpath)
# 提取spine
import json
from pathlib import Path
import os
import shutil
dst = 'spine'
for i in res.assetList:
if i.nativeVersion and i.nativeExt and i.realPath:
if 'homeSpine' in i.realPath:
srcpath = downloader.convertUrltoPath(res.convertInfoToUrl('native', i.uuid, i.nativeVersion, i.nativeExt))
if i.nativeExt =='.bin':
if i.importType != 'IND':
packinfo = i.importFrom.split('.')
packpath = downloader.convertUrltoPath(res.convertInfoToUrl('import',*packinfo))
atlas =json.loads(Path(importPath).read_text(encoding='utf-8'))[5][0][3]
else:
importPath = downloader.convertUrltoPath(res.convertInfoToUrl('import',i.uuid,i.importVersion,i.importExt))
atlas = json.loads(Path(importPath).read_text(encoding='utf-8'))[5][0][3]
dstimport = f'{dst}/{i.realPath}.atlas'
downloader.mkdir(dstimport)
Path(dstimport).write_text(atlas,encoding='utf-8')
if os.path.exists(srcpath):
if i.nativeExt == '.bin':
dstext = '.skel'
else:
dstext = i.nativeExt
dstpath = f'{dst}/{i.realPath}{dstext}'
downloader.mkdir(dstpath)
if os.path.exists(dstpath):
continue
shutil.copy(srcpath,dstpath)