-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path04_formats.py
More file actions
36 lines (29 loc) · 1011 Bytes
/
04_formats.py
File metadata and controls
36 lines (29 loc) · 1011 Bytes
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
#!/usr/bin/env python3
"""Example: Scrape with multiple output formats.
QuickCrawl supports multiple output formats:
- markdown: Converted markdown text
- html: Clean HTML content
- links: All URLs found on the page
- json: LLM-extracted structured data (requires jsonSchema)
"""
from quickcrawl import QuickCrawlClient
def main():
with QuickCrawlClient() as client:
result = client.scrape(
"https://example.com",
formats=["markdown", "html", "links"],
only_main_content=True,
)
print("=== Markdown ===")
print(result.get("markdown", "")[:300])
print("\n=== Links Found ===")
links = result.get("links", [])
for link in links[:5]:
print(f" {link}")
if len(links) > 5:
print(f" ... and {len(links) - 5} more")
print("\n=== HTML Snippet ===")
html = result.get("html", "")
print(html[:200] if html else "No HTML")
if __name__ == "__main__":
main()