feat: add --no-check-certificate flag

This commit is contained in:
Long Huynh Huu
2025-07-09 03:52:19 +02:00
parent 615b420c74
commit 27d71cbb23
4 changed files with 20 additions and 0 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)