Add your description here
Project description
RiotManifest
riot提供的manifest文件进行解析下载
介绍
目前的功能是可以传入URL或本地文件目录,解析manifest文件,下载文件。
大部分代码都来自于CommunityDragon/CDTB项目,感谢他们的工作。
对PatcherManifest
进行修改使其支持URL manifest文件下载,细化filter_files
方法,使其支持正则表达式过滤文件。
对PatcherFile
增加download_file
方法,使其支持文件下载。并且使用aiohttp
进行异步下载。默认并发数为50,并发数可以通过实例化PatcherManifest
时 concurrency_limit
参数进行设置; 也可以调用PatcherFile
的download_file
方法时传入concurrency_limit
参数进行设置。
安装
pip3 install riotmanifest
使用
- 异步多并发下载(不推荐)
import asyncio
from riotmanifest import PatcherManifest
async def main():
bundle_url = 'https://lol.dyn.riotcdn.net/channels/public/bundles/'
manifest = PatcherManifest(
r"https://lol.secure.dyn.riotcdn.net/channels/public/releases/CB3A1B2A17ED9AAB.manifest",
path=r'E:\out',
bundle_url=bundle_url)
files = list(manifest.filter_files(flag='zh_CN', pattern='wad.client'))
await manifest.download_files_concurrently(files, 5)
if __name__ == '__main__':
asyncio.run(main())
注意,单个文件的下载并发是50,download_files_concurrently
方法是对多个文件进行并发下载。建议这个数不要超过10,否则有封IP的风险(实测PatcherManifest传入100,download_files_concurrently传入10,后台可查最大线程为800+,正常执行,量力而行)。
- ManifestDownloader外壳
from riotmanifest.external_manifest import ResourceDL
rdl = ResourceDL(r'E:\out')
rdl.d_game = True
rdl.download_resources('content-metadata.json')
直接调用开源程序Morilli/ManifestDownloader直接下载,具体查看函数文档
自动从GitHub下载可执行文件,保存至temp目录,默认使用代理
- WADExtractor
from riotmanifest.extractor import WADExtractor
we = WADExtractor("DE515F568F4D9C73.manifest")
data = we.extract_files(
{
"DATA/FINAL/Champions/Aatrox.wad.client": [
"data/characters/aatrox/skins/skin0.bin",
"data/characters/aatrox/skins/skin1.bin",
"data/characters/aatrox/skins/skin2.bin",
"data/characters/aatrox/skins/skin3.bin",
],
"DATA/FINAL/Champions/Ahri.wad.client": [
"data/characters/Ahri/skins/skin0.bin",
"data/characters/Ahri/skins/skin1.bin",
"data/characters/Ahri/skins/skin2.bin",
"data/characters/Ahri/skins/skin3.bin",
]
}
)
print(len(data))
该方法无需下载完整WAD文件,直接从manifest中计算需要解包的文件位置,直接获取,减少网络请求。
维护者
Virace
感谢
-
@CommunityDragon, CDTB
-
@Morilli, ManifestDownloader
-
以及JetBrains提供开发环境支持
许可证
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file riotmanifest-1.1.0.tar.gz
.
File metadata
- Download URL: riotmanifest-1.1.0.tar.gz
- Upload date:
- Size: 29.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b96fd90ae9b29fd9358fb52efa4d5850316c2e2e6cf9d8e9552b6cf0f8715b00 |
|
MD5 | b1f7fe771319a9f9976e4c752b7ea681 |
|
BLAKE2b-256 | 88355361ff1ddd5125f8dd1cf049cdde30fc74e4d0d927f39dfdcf7339c1dd20 |
File details
Details for the file riotmanifest-1.1.0-py3-none-any.whl
.
File metadata
- Download URL: riotmanifest-1.1.0-py3-none-any.whl
- Upload date:
- Size: 29.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f987766001a263f4f16333aa748ad6196d2a14183144b2bb0a807c91a278287e |
|
MD5 | cc8c2b2f179dd014394844007dae2a80 |
|
BLAKE2b-256 | 9b9490da1b2271c7036d377b7357b35d57d8d3645a098a894102554e110c1c48 |