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