Spaces:
Running
Running
Update README.md
Browse files
README.md
CHANGED
|
@@ -9,4 +9,38 @@ app_file: app.py
|
|
| 9 |
pinned: false
|
| 10 |
---
|
| 11 |
|
| 12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
pinned: false
|
| 10 |
---
|
| 11 |
|
| 12 |
+
# Browser API
|
| 13 |
+
|
| 14 |
+
This document describes how to use the Browser API to search the web and scrape website content. The API is built with Gradio and Playwright, providing a simple interface for web automation tasks.
|
| 15 |
+
|
| 16 |
+
## API Endpoint
|
| 17 |
+
|
| 18 |
+
The primary endpoint for this API is `/api/web_browse`. This is a `POST` endpoint that accepts a JSON payload.
|
| 19 |
+
|
| 20 |
+
## Authentication
|
| 21 |
+
|
| 22 |
+
This API is public and does not require authentication.
|
| 23 |
+
|
| 24 |
+
## Actions
|
| 25 |
+
|
| 26 |
+
The API can perform two main actions: `Search` and `Scrape URL`.
|
| 27 |
+
|
| 28 |
+
### Search
|
| 29 |
+
|
| 30 |
+
The `Search` action allows you to perform a web search using a specified search engine. The API will return the content of the search results page in Markdown format.
|
| 31 |
+
|
| 32 |
+
### Scrape URL
|
| 33 |
+
|
| 34 |
+
The `Scrape URL` action allows you to retrieve the content of a specific URL. The API will fetch the page, process the HTML, and return the main content in a clean, readable Markdown format.
|
| 35 |
+
|
| 36 |
+
## Request Body
|
| 37 |
+
|
| 38 |
+
The request body must be a JSON object with the following structure:
|
| 39 |
+
|
| 40 |
+
```json
|
| 41 |
+
{
|
| 42 |
+
"action": "Search" | "Scrape URL",
|
| 43 |
+
"query": "string",
|
| 44 |
+
"browser_name": "firefox" | "chromium" | "webkit",
|
| 45 |
+
"search_engine_name": "string"
|
| 46 |
+
}
|