Spaces:
No application file
No application file
Update app.py
Browse files
app.py
CHANGED
|
@@ -281,14 +281,14 @@ async def inspect(session_id: str):
|
|
| 281 |
|
| 282 |
try:
|
| 283 |
for sel in selectors:
|
| 284 |
-
|
| 285 |
-
|
| 286 |
-
|
| 287 |
-
|
| 288 |
-
|
| 289 |
-
|
| 290 |
-
|
| 291 |
-
|
| 292 |
return {"elements": out, "total_count": len(out)}
|
| 293 |
except Exception as e:
|
| 294 |
logger.error(f"Error inspecting elements: {e}")
|
|
|
|
| 281 |
|
| 282 |
try:
|
| 283 |
for sel in selectors:
|
| 284 |
+
for idx, elem in enumerate(soup.select(sel)):
|
| 285 |
+
out.append({
|
| 286 |
+
"tag": elem.name,
|
| 287 |
+
"selector": f"{sel}:nth-of-type({idx+1})",
|
| 288 |
+
"text": elem.get_text(strip=True)[:100],
|
| 289 |
+
"attributes": dict(elem.attrs),
|
| 290 |
+
"type": elem.get("type", "N/A")
|
| 291 |
+
})
|
| 292 |
return {"elements": out, "total_count": len(out)}
|
| 293 |
except Exception as e:
|
| 294 |
logger.error(f"Error inspecting elements: {e}")
|