mirror of
https://github.com/Benexl/FastAnime.git
synced 2026-01-07 19:00:51 -08:00
feat(download command): add headers functionality
This commit is contained in:
@@ -37,6 +37,7 @@ class YtDLPDownloader:
|
||||
vid_format: str = "best",
|
||||
force_unknown_ext=False,
|
||||
verbose=False,
|
||||
headers={},
|
||||
):
|
||||
"""Helper function that downloads anime given url and path details
|
||||
|
||||
@@ -52,6 +53,7 @@ class YtDLPDownloader:
|
||||
episode_title = sanitize_filename(episode_title)
|
||||
ydl_opts = {
|
||||
# Specify the output path and template
|
||||
"http_headers": headers,
|
||||
"outtmpl": f"{download_dir}/{anime_title}/{episode_title}.%(ext)s",
|
||||
"silent": silent,
|
||||
"verbose": verbose,
|
||||
|
||||
@@ -174,6 +174,7 @@ def download(
|
||||
input("Enter to continue")
|
||||
continue
|
||||
link = stream_link["link"]
|
||||
provider_headers = server["headers"]
|
||||
episode_title = server["episode_title"]
|
||||
else:
|
||||
with Progress() as progress:
|
||||
@@ -198,6 +199,7 @@ def download(
|
||||
print("Quality not found")
|
||||
continue
|
||||
link = stream_link["link"]
|
||||
provider_headers = servers[server]["headers"]
|
||||
|
||||
episode_title = servers[server]["episode_title"]
|
||||
print(f"[purple]Now Downloading:[/] {search_result} Episode {episode}")
|
||||
@@ -211,6 +213,7 @@ def download(
|
||||
config.format,
|
||||
force_unknown_ext,
|
||||
verbose,
|
||||
headers=provider_headers,
|
||||
)
|
||||
except Exception as e:
|
||||
print(e)
|
||||
|
||||
Reference in New Issue
Block a user