39 lines
1000 B
Python
39 lines
1000 B
Python
|
|
import couchdb
|
||
|
|
from urllib.parse import quote
|
||
|
|
import json
|
||
|
|
|
||
|
|
# Configuration
|
||
|
|
user = "admin"
|
||
|
|
password = "DonCucarach0!?"
|
||
|
|
ip_address = "100.100.112.48"
|
||
|
|
port = "5984"
|
||
|
|
db_name = "obsidiandb"
|
||
|
|
|
||
|
|
# Target Doc (one that looked like a filename in the dump)
|
||
|
|
target_id = "05 - fleeting/zig.md"
|
||
|
|
|
||
|
|
safe_password = quote(password, safe="")
|
||
|
|
url = f"http://{user}:{safe_password}@{ip_address}:{port}/"
|
||
|
|
|
||
|
|
print(f"Inspecting: {target_id}")
|
||
|
|
|
||
|
|
try:
|
||
|
|
server = couchdb.Server(url)
|
||
|
|
db = server[db_name]
|
||
|
|
|
||
|
|
if target_id in db:
|
||
|
|
doc = db[target_id]
|
||
|
|
print(json.dumps(doc, indent=2))
|
||
|
|
else:
|
||
|
|
print("Document not found. Trying another one...")
|
||
|
|
# Fallback to finding ANY doc with a path-like ID
|
||
|
|
for doc_id in db:
|
||
|
|
if "/" in doc_id and not doc_id.startswith("_"):
|
||
|
|
print(f"Found alternative: {doc_id}")
|
||
|
|
doc = db[doc_id]
|
||
|
|
print(json.dumps(doc, indent=2))
|
||
|
|
break
|
||
|
|
|
||
|
|
except Exception as e:
|
||
|
|
print(f"Error: {e}")
|