1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "mode": "messy_text",
12 "inputText": `Name: John Doe | Age: 29 | City: New York | Active: yes
13Name: Jane Smith | Age: 32 | City: Los Angeles | Active: true
14Name: Bob Johnson | Age: 45 | City: Chicago | Active: no`,
15 "fileUrl": "",
16 "urls": [
17 {
18 "url": "https://books.toscrape.com/"
19 }
20 ],
21 "textParseStrategy": "auto",
22 "kvFormat": "auto",
23 "htmlExtractMode": "auto",
24 "cssSelector": "article.product_pod",
25 "fieldMap": `{
26 "title": "h3 a",
27 "price": ".price_color",
28 "availability": ".availability",
29 "rating": "p.star-rating"
30}`,
31 "sheetName": "",
32 "skipEmptyRows": true,
33 "forwardFillColumns": "",
34 "pageSize": 0,
35 "outputFormat": "records",
36 "proxyConfiguration": {
37 "useApifyProxy": true
38 },
39 "maxRequestRetries": 3
40};
41
42
43const run = await client.actor("moving_beacon-owner1/my-actor-66").call(input);
44
45
46console.log('Results from dataset');
47console.log(`πΎ Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
48const { items } = await client.dataset(run.defaultDatasetId).listItems();
49items.forEach((item) => {
50 console.dir(item);
51});
52
53