Update rest call how to use
This commit is contained in:
@@ -1,13 +1,26 @@
|
|||||||
import requests
|
|
||||||
|
|
||||||
|
|
||||||
|
import requests, base64
|
||||||
|
|
||||||
data = {
|
data = {
|
||||||
"urls": [
|
"urls": [
|
||||||
"https://www.nbcnews.com/business"
|
"https://www.nbcnews.com/business"
|
||||||
],
|
],
|
||||||
"word_count_threshold": 5,
|
|
||||||
"screenshot": True
|
"screenshot": True
|
||||||
}
|
}
|
||||||
|
|
||||||
response = requests.post("https://crawl4ai.com/crawl", json=data) # OR local host if your run locally
|
response = requests.post("https://crawl4ai.com/crawl", json=data) # OR local host if your run locally
|
||||||
response_data = response.json()
|
result = response.json()['results'][0]
|
||||||
print(response_data['results'][0].keys())
|
|
||||||
|
|
||||||
|
print(result['markdown'])
|
||||||
|
print(result['cleaned_html'])
|
||||||
|
print(result['media'])
|
||||||
|
print(result['extracted_content'])
|
||||||
|
with open("screenshot.png", "wb") as f:
|
||||||
|
f.write(base64.b64decode(result['screenshot']))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user