aegis402/deploy/inspect_smithery.py

30 lines
1.0 KiB
Python

"""Inspect smithery.ai/new submission form."""
from playwright.sync_api import sync_playwright
from pathlib import Path
OUT = Path(__file__).resolve().parent.parent / "data" / "smithery_new.html"
with sync_playwright() as p:
b = p.chromium.launch(headless=True)
ctx = b.new_context(user_agent="Mozilla/5.0 Aegis402-bot/0.1")
page = ctx.new_page()
page.goto("https://smithery.ai/new", wait_until="networkidle", timeout=45000)
OUT.write_text(page.content())
print("URL:", page.url)
print("TITLE:", page.title())
# capture all forms / inputs
inputs = page.query_selector_all("input")
print(f"INPUTS: {len(inputs)}")
for i in inputs:
print(" -", i.get_attribute("name"), i.get_attribute("type"), i.get_attribute("placeholder"))
btns = page.query_selector_all("button")
print(f"BUTTONS: {len(btns)}")
for bt in btns:
t = bt.inner_text().strip()
if t:
print(" -", t)
# body text first 1500 chars
print("---BODY---")
print(page.inner_text("body")[:1500])
b.close()