sd
This commit is contained in:
@@ -1476,6 +1476,36 @@ class HydrusNetwork(Store):
|
||||
debug(f"{self._log_prefix()} get_url failed: {exc}")
|
||||
return []
|
||||
|
||||
def get_url_info(self, url: str, **kwargs: Any) -> dict[str, Any] | None:
|
||||
"""Return Hydrus URL info for a single URL (Hydrus-only helper).
|
||||
|
||||
Uses: GET /add_urls/get_url_info
|
||||
"""
|
||||
try:
|
||||
client = self._client
|
||||
if client is None:
|
||||
return None
|
||||
u = str(url or "").strip()
|
||||
if not u:
|
||||
return None
|
||||
try:
|
||||
return client.get_url_info(u) # type: ignore[attr-defined]
|
||||
except Exception:
|
||||
from API.HydrusNetwork import HydrusRequestSpec
|
||||
|
||||
spec = HydrusRequestSpec(
|
||||
method="GET",
|
||||
endpoint="/add_urls/get_url_info",
|
||||
query={
|
||||
"url": u
|
||||
},
|
||||
)
|
||||
response = client._perform_request(spec) # type: ignore[attr-defined]
|
||||
return response if isinstance(response, dict) else None
|
||||
except Exception as exc:
|
||||
debug(f"{self._log_prefix()} get_url_info failed: {exc}")
|
||||
return None
|
||||
|
||||
def add_url(self, file_identifier: str, url: List[str], **kwargs: Any) -> bool:
|
||||
"""Associate one or more url with a Hydrus file."""
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user