diff --git a/fastanime/Utility/downloader/downloader.py b/fastanime/Utility/downloader/downloader.py index 909e668..1dda018 100644 --- a/fastanime/Utility/downloader/downloader.py +++ b/fastanime/Utility/downloader/downloader.py @@ -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, diff --git a/fastanime/cli/commands/download.py b/fastanime/cli/commands/download.py index d77c7d5..7f2851a 100644 --- a/fastanime/cli/commands/download.py +++ b/fastanime/cli/commands/download.py @@ -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)