forked from DRMTalks/devine
Add byte-range option to the aria2c downloader
This commit is contained in:
parent
0c02b1513a
commit
af5e6acbb8
|
@ -11,7 +11,8 @@ async def aria2c(
|
||||||
uri: Union[str, list[str]],
|
uri: Union[str, list[str]],
|
||||||
out: Path,
|
out: Path,
|
||||||
headers: Optional[dict] = None,
|
headers: Optional[dict] = None,
|
||||||
proxy: Optional[str] = None
|
proxy: Optional[str] = None,
|
||||||
|
byte_range: Optional[str] = None
|
||||||
) -> int:
|
) -> int:
|
||||||
"""
|
"""
|
||||||
Download files using Aria2(c).
|
Download files using Aria2(c).
|
||||||
|
@ -68,6 +69,9 @@ async def aria2c(
|
||||||
continue
|
continue
|
||||||
arguments.extend(["--header", f"{header}: {value}"])
|
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":
|
if proxy and proxy.lower().split(":")[0] != "http":
|
||||||
# HTTPS proxies not supported by Aria2c.
|
# HTTPS proxies not supported by Aria2c.
|
||||||
# Proxy the proxy via pproxy to access it as a HTTP proxy.
|
# Proxy the proxy via pproxy to access it as a HTTP proxy.
|
||||||
|
|
Loading…
Reference in New Issue