Merge pull request #97 from cornservant/feat/no-check-certificate-flag

Add a --no-check-certificate flag
This commit is contained in:
Benexl
2025-07-24 14:11:30 +03:00
committed by GitHub
5 changed files with 28 additions and 2 deletions

View File

@@ -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:

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -16,7 +16,7 @@
pname = "fastanime";
version = "2.8.8";
src = ./.;
src = self;
preBuild = ''
sed -i 's/rich>=13.9.2/rich>=13.8.1/' pyproject.toml
@@ -50,14 +50,20 @@
# DevShell for development
devShells.default = pkgs.mkShell {
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath [ pkgs.libxcrypt-legacy ];
buildInputs = [
fastanimeEnv
pythonPackages.hatchling
pkgs.mpv
pkgs.libmpv
pkgs.fzf
pkgs.rofi
pkgs.uv
pkgs.pyright
];
shellHook = ''
uv venv -q
source ./.venv/bin/activate
'';
};
});
}