From 27d71cbb23396e4c52ddd04e9484d2f2f0fc08ad Mon Sep 17 00:00:00 2001 From: Long Huynh Huu Date: Wed, 9 Jul 2025 03:52:19 +0200 Subject: [PATCH] feat: add --no-check-certificate flag --- fastanime/Utility/downloader/downloader.py | 2 ++ fastanime/cli/commands/anilist/download.py | 7 +++++++ fastanime/cli/commands/download.py | 9 +++++++++ fastanime/cli/interfaces/anilist_interfaces.py | 2 ++ 4 files changed, 20 insertions(+) diff --git a/fastanime/Utility/downloader/downloader.py b/fastanime/Utility/downloader/downloader.py index 0cd833a..c48fa6e 100644 --- a/fastanime/Utility/downloader/downloader.py +++ b/fastanime/Utility/downloader/downloader.py @@ -46,6 +46,7 @@ class YtDLPDownloader: force_ffmpeg=False, hls_use_mpegts=False, hls_use_h264=False, + nocheckcertificate=False, ): """Helper function that downloads anime given url and path details @@ -87,6 +88,7 @@ class YtDLPDownloader: "format": vid_format, "compat_opts": ("allow-unsafe-ext",) if force_unknown_ext else tuple(), "progress_hooks": progress_hooks, + "nocheckcertificate": nocheckcertificate, } urls = [url] if sub: diff --git a/fastanime/cli/commands/anilist/download.py b/fastanime/cli/commands/anilist/download.py index 02a2897..6eec17a 100644 --- a/fastanime/cli/commands/anilist/download.py +++ b/fastanime/cli/commands/anilist/download.py @@ -123,6 +123,11 @@ from .data import ( is_flag=True, help="Use H.264 (MP4) for hls streams, resulted in .mp4 file (useful for some streams: see Docs) (this option forces --force-ffmpeg to be True)", ) +@click.option( + "--no-check-certificates", + is_flag=True, + help="Suppress HTTPS certificate validation", +) @click.option( "--max-results", "-M", type=int, help="The maximum number of results to show" ) @@ -149,6 +154,7 @@ def download( force_ffmpeg, hls_use_mpegts, hls_use_h264, + no_check_certificates, max_results, ): from rich import print @@ -386,6 +392,7 @@ def download( force_ffmpeg=force_ffmpeg, hls_use_mpegts=hls_use_mpegts, hls_use_h264=hls_use_h264, + nocheckcertificate=no_check_certificates, ) except Exception as e: print(e) diff --git a/fastanime/cli/commands/download.py b/fastanime/cli/commands/download.py index 728da25..7f5f2fc 100644 --- a/fastanime/cli/commands/download.py +++ b/fastanime/cli/commands/download.py @@ -129,6 +129,11 @@ if TYPE_CHECKING: is_flag=True, help="Use H.264 (MP4) for hls streams, resulted in .mp4 file (useful for some streams: see Docs) (this option forces --force-ffmpeg to be True)", ) +@click.option( + "--no-check-certificates", + is_flag=True, + help="Suppress HTTPS certificate validation", +) @click.pass_obj def download( config: "Config", @@ -145,6 +150,7 @@ def download( force_ffmpeg, hls_use_mpegts, hls_use_h264, + no_check_certificates, ): import time @@ -208,6 +214,7 @@ def download( force_ffmpeg, hls_use_mpegts, hls_use_h264, + no_check_certificates, ) return search_results = search_results["results"] @@ -262,6 +269,7 @@ def download( force_ffmpeg, hls_use_mpegts, hls_use_h264, + no_check_certificates, ) return @@ -399,6 +407,7 @@ def download( force_ffmpeg=force_ffmpeg, hls_use_mpegts=hls_use_mpegts, hls_use_h264=hls_use_h264, + nocheckcertificate=no_check_certificates, ) except Exception as e: print(e) diff --git a/fastanime/cli/interfaces/anilist_interfaces.py b/fastanime/cli/interfaces/anilist_interfaces.py index 99983c2..fcf07fa 100644 --- a/fastanime/cli/interfaces/anilist_interfaces.py +++ b/fastanime/cli/interfaces/anilist_interfaces.py @@ -1022,6 +1022,7 @@ def download_anime(config: "Config", fastanime_runtime_state: "FastAnimeRuntimeS force_ffmpeg = Confirm.ask("Force ffmpeg", default=False) hls_use_mpegts = Confirm.ask("Use mpegts", default=False) hls_use_h264 = Confirm.ask("Use h264", default=False) + nocheckcertificate = True force_ffmpeg |= hls_use_mpegts or hls_use_h264 anime_title = Prompt.ask( @@ -1218,6 +1219,7 @@ def download_anime(config: "Config", fastanime_runtime_state: "FastAnimeRuntimeS force_ffmpeg=force_ffmpeg, hls_use_mpegts=hls_use_mpegts, hls_use_h264=hls_use_h264, + nocheckcertificate=nocheckcertificate, ) except Exception as e: print(e)