Skip to content

Commit

Permalink
perfect(Alist2Strm):下载文件直接请求path.raw_url减少一次重定向
Browse files Browse the repository at this point in the history
  • Loading branch information
Akimio521 committed Aug 1, 2024
1 parent c419e01 commit fa5090a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/modules/alist2strm/alist2strm.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ async def run(self) -> None:
def filter(path: AlistPath) -> bool:
if path.is_dir:
return False

if not path.suffix.lower() in self.process_file_exts:
logger.debug(f"文件{path.name}不在处理列表中")
return False
Expand All @@ -104,7 +104,7 @@ def filter(path: AlistPath) -> bool:
return False

return True

async with self.__max_workers:
async with ClientSession() as session:
self.session = session
Expand Down Expand Up @@ -144,7 +144,7 @@ async def __file_processer(self, path: AlistPath) -> None:
async with self.__max_downloaders:
async with async_open(local_path, mode="wb") as file:
_write = file.write
async with self.session.get(url) as resp:
async with self.session.get(path.raw_url) as resp:
async for chunk in resp.content.iter_chunked(1024):
await _write(chunk)
logger.info(f"{local_path.name}下载成功")
Expand Down

0 comments on commit fa5090a

Please sign in to comment.