No project description provided
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
poetry
poetry add riotmanifest
使用
import asyncio
from riotmanifest.manifest 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+,正常执行,量力而行)。
维护者
Virace
感谢
-
@CommunityDragon, CDTB
-
以及JetBrains提供开发环境支持
许可证
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
riotmanifest-1.0.2.tar.gz
(20.5 kB
view hashes)
Built Distribution
Close
Hashes for riotmanifest-1.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3b3b86ed5e4c13de03d5de637aad3cc9cdd2b9671d4e5d7418f6862ccdbb489a |
|
MD5 | aa97cf4d59b1639444bcce1b2d9c6ded |
|
BLAKE2b-256 | 0729cf75143723d240f47da9c122088f45de68f4853a6f6e7779e54d57e28bc2 |