1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "pages": [
12 {
13 "url": "https://example.com/",
14 "title": "Example Shop: Handmade Goods for Everyday Life",
15 "description": "Browse handmade goods for the home, from durable kitchenware to compact desk gear, shipped fast from our local workshop.",
16 "canonical": "https://example.com/",
17 "h1": [
18 "Example Shop"
19 ],
20 "lang": "en",
21 "wordCount": 420
22 },
23 {
24 "url": "https://example.com/products/widget",
25 "title": "Handmade Widget for Home and Office Use",
26 "canonical": "https://example.com/products/widget",
27 "h1": [
28 "Handmade Widget"
29 ],
30 "lang": "en",
31 "wordCount": 310
32 },
33 {
34 "url": "https://example.com/products/gadget",
35 "title": "The Ultimate Handmade Gadget with an Extremely Long Name That Keeps Going and Going Forever",
36 "description": "A compact handmade gadget that fits any desk, built from durable materials and finished by hand in our local workshop.",
37 "canonical": "https://example.com/products/gadget",
38 "h1": [
39 "Ultimate Gadget"
40 ],
41 "lang": "en",
42 "wordCount": 280
43 },
44 {
45 "url": "https://example.com/blog/seo-tips",
46 "title": "SEO Tips for Online Stores: A Practical Guide",
47 "description": "Practical tips for improving your online store visibility, from titles and descriptions to clean URLs and fast pages.",
48 "canonical": "https://example.com/blog/seo-tips",
49 "h1": [
50 "SEO Tips"
51 ],
52 "lang": "en",
53 "wordCount": 650
54 },
55 {
56 "url": "https://example.com/blog/seo-tips-2",
57 "title": "SEO Tips for Online Stores: A Practical Guide",
58 "description": "A second collection of ideas for growing store traffic with better metadata, structured pages and consistent internal links.",
59 "canonical": "https://example.com/blog/seo-tips-2",
60 "h1": [
61 "SEO Tips Part Two",
62 "More Tips"
63 ],
64 "lang": "en",
65 "wordCount": 540
66 },
67 {
68 "url": "https://example.com/blog/old-post",
69 "title": "Our Old Post About Shipping Policies and Returns",
70 "description": "This older post explains how shipping and returns used to work before we moved to the new fulfillment partner last year.",
71 "canonical": "https://example.com/blog/new-post",
72 "h1": [
73 "Old Shipping Post"
74 ],
75 "lang": "en",
76 "wordCount": 230
77 }
78 ]
79};
80
81
82const run = await client.actor("hiredhandai/seo-metadata-auditor").call(input);
83
84
85console.log('Results from dataset');
86console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
87const { items } = await client.dataset(run.defaultDatasetId).listItems();
88items.forEach((item) => {
89 console.dir(item);
90});
91
92