-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdemo.py
More file actions
33 lines (27 loc) · 826 Bytes
/
demo.py
File metadata and controls
33 lines (27 loc) · 826 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
from scraper import scrape_website
def main():
url = "https://example.com"
print(f"Demonstrating advanced scraper with {url}")
# Example with filters and JSON export
content = scrape_website(
url,
filters={
"min_length": 10,
"keywords": ["content", "section"]
},
export_format="json",
export_path="scraped_content.json"
)
print("\nExtracted content:")
print(f"Title: {content.title}")
print("\nHeadings:")
for heading in content.headings:
print(f"- {heading}")
print("\nParagraphs:")
for para in content.paragraphs:
print(f"- {para}")
print("\nMetadata:")
for key, value in content.metadata.items():
print(f"- {key}: {value}")
if __name__ == "__main__":
main()