1from apify_client import ApifyClient
2
3
4
5client = ApifyClient("<YOUR_API_TOKEN>")
6
7
8run_input = {
9 "converter_type": "html_to_clean_text",
10 "html_input": """<!DOCTYPE html>
11<html>
12<head><title>Sample Article β AI Trends</title></head>
13<body>
14<nav>Home | Tech</nav>
15<script>trackPageView();</script>
16<article>
17 <h1>AI Trends Shaping the Future</h1>
18 <p>Artificial intelligence continues to evolve at a breathtaking pace.</p>
19 <p>Multimodal AI systems combining text, image, and audio are becoming mainstream.</p>
20</article>
21<footer>© 2025 TechNews</footer>
22</body>
23</html>""",
24 "preserve_links": True,
25 "preserve_line_breaks": True,
26 "summary_sentences": 5,
27 "json_input": """{
28 \"company\": \"TechCorp Inc.\",
29 \"fiscal_year\": 2025,
30 \"departments\": [
31 {\"name\": \"Engineering\", \"headcount\": 150, \"budget\": 5000000},
32 {\"name\": \"Marketing\", \"headcount\": 45, \"budget\": 2000000}
33 ]
34}""",
35 "report_max_width": 100,
36 "log_input": """2025-01-15T08:30:01.123Z [INFO] [AuthService] User login successful: user_id=12345
372025-01-15T08:30:10.012Z [ERROR] [PaymentGateway] Transaction failed: timeout after 30s
382025-01-15T08:31:05.222Z [CRITICAL] [DiskMonitor] Disk usage at 95%""",
39 "form_input": """{
40 \"first_name\": \"Ali\",
41 \"last_name\": \"Hassan\",
42 \"email\": \"ali.hassan@example.com\",
43 \"age\": \"28\",
44 \"is_subscribed\": \"yes\"
45}""",
46 "field_mapping": """{
47 \"first_name\": \"user.firstName\",
48 \"last_name\": \"user.lastName\",
49 \"email\": \"user.email\"
50}""",
51 "api_base_url": "https://api.example.com",
52 "api_endpoint": "/v2/users/register",
53 "api_method": "POST",
54 "api_auth_type": "bearer",
55 "validation_rules": """{
56 \"first_name\": {\"required\": true},
57 \"email\": {\"required\": true}
58}""",
59 "url_to_scrape": "",
60}
61
62
63run = client.actor("moving_beacon-owner1/my-actor-65").call(run_input=run_input)
64
65
66print("πΎ Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
67for item in client.dataset(run["defaultDatasetId"]).iterate_items():
68 print(item)
69
70