-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
36 lines (30 loc) · 1.12 KB
/
main.py
File metadata and controls
36 lines (30 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import os
from scrapi_sdk import ScrapeRequest, ScrapiClient
URL = "https://deventerprise.com"
api_key = os.getenv("SCRAPI_API_KEY", "")
request = ScrapeRequest(URL)
request.use_browser = True
request.include_screenshot = True
request.include_video = True
request.include_pdf = True
with ScrapiClient(api_key) as client:
print(f"Scraping {URL}")
print()
response = client.scrape(request)
if response is None:
print("No response was returned by ScrAPI.")
else:
preview = (response.content or "").strip().replace("\n", " ")
if len(preview) > 200:
preview = preview[:200] + "..."
print(f"Request URL : {response.request_url}")
print(f"Response URL : {response.response_url}")
print(f"Status Code : {response.status_code}")
print(f"Duration : {response.duration}")
print(f"Credits Used : {response.credits_used}")
print(f"Screenshot URL : {response.screenshot_url}")
print(f"Video URL : {response.video_url}")
print(f"PDF URL : {response.pdf_url}")
print(f"Content Hash : {response.content_hash}")
print(f"Preview : {preview}")
print()