Download multiple URLs and return sandbox handles to the saved artifacts. Args: urls (required): list of urls Returns: { results: [{ url, handle }] }
(ctx: Context, urls: List[str])
| 50 | |
| 51 | |
| 52 | async def web_fetch_urls(ctx: Context, urls: List[str]) -> dict: |
| 53 | """ |
| 54 | Download multiple URLs and return sandbox handles to the saved artifacts. |
| 55 | |
| 56 | Args: |
| 57 | urls (required): list of urls |
| 58 | |
| 59 | Returns: |
| 60 | { |
| 61 | results: [{ url, handle }] |
| 62 | } |
| 63 | """ |
| 64 | sid = _sid(ctx) |
| 65 | results: List[Dict[str, Any]] = [] |
| 66 | |
| 67 | for url in urls: |
| 68 | try: |
| 69 | nav = await browser_navigate(ctx, url) |
| 70 | if not nav or "error" in nav: |
| 71 | continue |
| 72 | |
| 73 | saved = await _save_current_page_html(ctx, nav.get("url") or url) |
| 74 | if "error" not in saved: |
| 75 | results.append({"url": url, "handle": saved["handle"]}) |
| 76 | except Exception: |
| 77 | continue |
| 78 | |
| 79 | MANAGER.touch(sid) |
| 80 | return _ok(results=results) |
| 81 | |
| 82 | |
| 83 | async def web_fetch_and_parse_urls( |
no test coverage detected