From 768d048e1cabbd4f4552c0816874d43589151dce Mon Sep 17 00:00:00 2001 From: unclecode Date: Fri, 7 Jun 2024 18:10:45 +0800 Subject: [PATCH] Update rest call how to use --- docs/examples/rest_call.py | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/docs/examples/rest_call.py b/docs/examples/rest_call.py index 01b2ec54..eb462221 100644 --- a/docs/examples/rest_call.py +++ b/docs/examples/rest_call.py @@ -1,13 +1,26 @@ -import requests + + + +import requests, base64 data = { "urls": [ "https://www.nbcnews.com/business" ], - "word_count_threshold": 5, "screenshot": True } response = requests.post("https://crawl4ai.com/crawl", json=data) # OR local host if your run locally -response_data = response.json() -print(response_data['results'][0].keys()) \ No newline at end of file +result = response.json()['results'][0] + + +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'])) + + + +