ff
This commit is contained in:
@@ -12,6 +12,7 @@ from cmdlet._shared import Cmdlet, CmdletArg
|
||||
from SYS.config import load_config, save_config
|
||||
from SYS.logger import log, debug
|
||||
from SYS.result_table import Table
|
||||
from SYS.utils import extract_hydrus_hash_from_url
|
||||
from SYS import pipeline as ctx
|
||||
|
||||
_MATRIX_PENDING_ITEMS_KEY = "matrix_pending_items"
|
||||
@@ -543,17 +544,8 @@ def _extract_sha256_hex(item: Any) -> Optional[str]:
|
||||
|
||||
|
||||
def _extract_hash_from_hydrus_file_url(url: str) -> Optional[str]:
|
||||
try:
|
||||
parsed = urlparse(url)
|
||||
if not (parsed.path or "").endswith("/get_files/file"):
|
||||
return None
|
||||
qs = parse_qs(parsed.query or "")
|
||||
h = (qs.get("hash") or [None])[0]
|
||||
if isinstance(h, str) and _SHA256_RE.fullmatch(h.strip()):
|
||||
return h.strip().lower()
|
||||
except Exception:
|
||||
pass
|
||||
return None
|
||||
"""Extract hash from Hydrus URL using centralized utility."""
|
||||
return extract_hydrus_hash_from_url(url)
|
||||
|
||||
|
||||
def _maybe_download_hydrus_file(item: Any,
|
||||
|
||||
Reference in New Issue
Block a user