Closed Akimio521 closed 3 months ago
在web界面使用anime账户登录,复制出的下载链接是正确的urlhttps://alist.example/d/onedrive/anime/season01/01.mkv
好的
已修复,更新一下即可
pip install -U 'python-alist>=0.0.12.2'
问一句题外话,由于AlistFileSystem.rglob()
并不支持正则表达式,所以我使用下面这种方法进行操作,但是AlistFileSystem.rglob()
本身也不支持异步的形式,会导致有大量时间花费在遍历fs.rglob("*")上,但其实download()本身很大一部分时间都花费在I/O上了,如果遍历本身可以改成异步的形式,就会先释放一段时间进入download()让其在后台进行I/O
async def download(url):
pass
async def main();
my_reg = r"S\d{2}\s*-\s*S\d{2}|S\d{2}|\s+S\d{1,2}|EP?\d{2,4}\s*-\s*EP?\d{2,4}|EP?\d{2,4}|\s+EP?\d{1,4}"
fs = AlistFileSystem()
for path in fs.rglob("*")
if re.match(my_reg , path.name):
await download(path.url)
刚开始学习异步/阻塞,使用生成器、迭代器不太熟练,请问有没有什么比较好的解决方法
AlistClient的大部分方法都支持异步,AlistFileSystem暂时不支持,你可以只用AlistClient,根据需要编写代码
Alist创建多用户时可以使用非基本路径 例如我现在的alist路径如下:/onedrive/anime/season01/01.mkv 我创建了一个子用户anime,并且设置了基本路径为/onedrive/anime
可以看到打印出的url为
https://alist.example/d/season01/01.mkv
,访问该url无法下载文件 正确url为https://alist.example/d/onedrive/anime/season01/01.mkv
,访问该url可以正确下载文件