broadfield-dev commited on
Commit
9f76443
·
verified ·
1 Parent(s): 383c5ed

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +94 -1
README.md CHANGED
@@ -43,4 +43,97 @@ The request body must be a JSON object with the following structure:
43
  "query": "string",
44
  "browser_name": "firefox" | "chromium" | "webkit",
45
  "search_engine_name": "string"
46
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43
  "query": "string",
44
  "browser_name": "firefox" | "chromium" | "webkit",
45
  "search_engine_name": "string"
46
+ }
47
+ ```
48
+
49
+ **Parameters:**
50
+
51
+ * `action` (string, required): The action to perform. Must be either `"Search"` or `"Scrape URL"`.
52
+ * `query` (string, required): The search query or the URL to scrape.
53
+ * `browser_name` (string, optional): The browser to use for the operation. Defaults to `"firefox"`.
54
+ * Available options: `"firefox"`, `"chromium"`, `"webkit"`.
55
+ * `search_engine_name` (string, optional): The search engine to use when the action is `"Search"`. Defaults to `"DuckDuckGo"`.
56
+ * A full list of supported search engines can be found in the "Supported Search Engines" section.
57
+
58
+ ## Response Body
59
+
60
+ The API will return a JSON object with the results of the operation.
61
+
62
+ **On Success:**
63
+
64
+ ```json
65
+ {
66
+ "status": "success",
67
+ "query": "your_query",
68
+ "action": "Search" | "Scrape URL",
69
+ "final_url": "https://example.com",
70
+ "page_title": "Example Domain",
71
+ "http_status": 200,
72
+ "proxy_used": "Direct Connection",
73
+ "markdown_content": "# Example Domain..."
74
+ }
75
+ ```
76
+
77
+ **On Error:**
78
+
79
+ ```json
80
+ {
81
+ "status": "error",
82
+ "query": "your_query",
83
+ "proxy_used": "Direct Connection",
84
+ "error_message": "Navigation Timeout: The page for 'your_query' took too long to load."
85
+ }
86
+ ```
87
+
88
+ ## Examples
89
+
90
+ Here are some examples of how to use the API with `curl`.
91
+
92
+ ### Example 1: Performing a Search
93
+
94
+ This example performs a search for "latest AI research" using Google.
95
+
96
+ ```bash
97
+ curl -X POST -H "Content-Type: application/json" \
98
+ -d '{
99
+ "action": "Search",
100
+ "query": "latest AI research",
101
+ "browser_name": "chromium",
102
+ "search_engine_name": "Google"
103
+ }' \
104
+ https://broadfield-dev-browser.hf.space/api/web_browse
105
+ ```
106
+
107
+ ### Example 2: Scraping a URL
108
+
109
+ This example scrapes the content from the Wikipedia page for "Web scraping".
110
+
111
+ ```bash
112
+ curl -X POST -H "Content-Type: application/json" \
113
+ -d '{
114
+ "action": "Scrape URL",
115
+ "query": "https://en.wikipedia.org/wiki/Web_scraping",
116
+ "browser_name": "firefox"
117
+ }' \
118
+ https://broadfield-dev-browser.hf.space/api/web_browse
119
+ ```
120
+
121
+ ## Supported Search Engines
122
+
123
+ The following search engines are supported when using the `"Search"` action:
124
+
125
+ * Google
126
+ * DuckDuckGo
127
+ * Bing
128
+ * Brave
129
+ * Ecosia
130
+ * Yahoo
131
+ * Startpage
132
+ * Qwant
133
+ * Swisscows
134
+ * You.com
135
+ * SearXNG
136
+ * MetaGer
137
+ * Yandex
138
+ * Baidu
139
+ * Perplexity