1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "urls": [
12 {
13 "url": "https://quotes.toscrape.com/"
14 }
15 ],
16 "mode": "html-only",
17 "proxyConfiguration": {
18 "useApifyProxy": true,
19 "apifyProxyGroups": [
20 "RESIDENTIAL"
21 ]
22 },
23 "schema": {
24 "type": "object",
25 "properties": {
26 "title": {
27 "type": "string",
28 "description": "Page title"
29 },
30 "quotes": {
31 "type": "array",
32 "items": {
33 "type": "object",
34 "properties": {
35 "text": {
36 "type": "string"
37 },
38 "author": {
39 "type": "string"
40 }
41 }
42 },
43 "description": "Quotes with text and author"
44 },
45 "links": {
46 "type": "array",
47 "items": {
48 "type": "string"
49 },
50 "description": "Important links"
51 }
52 },
53 "required": [
54 "title",
55 "quotes"
56 ]
57 }
58};
59
60
61const run = await client.actor("tuguidragos/hybrid-vision-spider-ai-powered-universal-web-scraper").call(input);
62
63
64console.log('Results from dataset');
65console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
66const { items } = await client.dataset(run.defaultDatasetId).listItems();
67items.forEach((item) => {
68 console.dir(item);
69});
70
71