From af5e6acbb85eb5c785ab3a558ed0d79d33788a74 Mon Sep 17 00:00:00 2001 From: rlaphoenix Date: Mon, 13 Feb 2023 18:43:36 +0000 Subject: [PATCH] Add byte-range option to the aria2c downloader --- devine/core/downloaders/aria2c.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/devine/core/downloaders/aria2c.py b/devine/core/downloaders/aria2c.py index 591175b..0b4175e 100644 --- a/devine/core/downloaders/aria2c.py +++ b/devine/core/downloaders/aria2c.py @@ -11,7 +11,8 @@ async def aria2c( uri: Union[str, list[str]], out: Path, headers: Optional[dict] = None, - proxy: Optional[str] = None + proxy: Optional[str] = None, + byte_range: Optional[str] = None ) -> int: """ Download files using Aria2(c). @@ -68,6 +69,9 @@ async def aria2c( continue arguments.extend(["--header", f"{header}: {value}"]) + if byte_range: + arguments.extend(["--header", f"Range: bytes={byte_range}"]) + if proxy and proxy.lower().split(":")[0] != "http": # HTTPS proxies not supported by Aria2c. # Proxy the proxy via pproxy to access it as a HTTP proxy.