You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 97d53e4
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: README.md
+87Lines changed: 87 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -143,8 +143,20 @@ from diffbot import Diffbot
143
143
144
144
db = Diffbot(token="YOUR_TOKEN")
145
145
data = db.extract("https://www.example.com")
146
+
147
+
# Optional keyword-only options (per-API field names are type-checked):
148
+
article = db.extract(
149
+
"https://www.example.com/post",
150
+
"article",
151
+
fmt="json",
152
+
timeout=60000, # server-side fetch timeout in ms (default 30000)
153
+
fields=["links", "quotes"],
154
+
max_tags=5,
155
+
)
146
156
```
147
157
158
+
`timeout` is the Diffbot-side fetch timeout in milliseconds; the SDK raises the HTTP transport timeout to at least `timeout + 10s` so the client never aborts first. `mode` overrides the `fmt="markdown"` → `mode=llm` mapping, and `extra={"proxy": ..., "proxyAuth": ...}` passes anything not named.
159
+
148
160
### Ask Diffbot LLM
149
161
```python
150
162
from diffbot import Diffbot
@@ -199,12 +211,47 @@ for event in db.crawl("https://www.example.com", hops=1):
199
211
print(event)
200
212
```
201
213
214
+
For tools that can't block on a long crawl, start the job without watching, poll it, then download the results:
215
+
216
+
```python
217
+
import time
218
+
from diffbot import Diffbot
219
+
220
+
db = Diffbot(token="YOUR_TOKEN")
221
+
for _ in db.crawl("https://www.example.com", job_name="my-crawl", hops=1):
222
+
pass# watch=False (the default): only creates the job
223
+
224
+
while db.crawl_get_job("my-crawl").get("jobStatus", {}).get("status", 0) in (0, 7):
225
+
time.sleep(5) # 0 initializing, 7 in progress; 9 complete
226
+
227
+
records = db.crawl_download("my-crawl") # list of extracted records
0 commit comments