1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "contracts": [
12 {
13 "actorId": "example-actor-id",
14 "ownerUsername": "example_owner",
15 "slug": "page-metadata-extractor",
16 "name": "Page Metadata Extractor",
17 "description": "Turn public webpage URLs into structured metadata records.",
18 "inputSchema": {
19 "type": "object",
20 "properties": {
21 "urls": {
22 "type": "array",
23 "items": {
24 "type": "string"
25 }
26 }
27 },
28 "required": [
29 "urls"
30 ],
31 "additionalProperties": false
32 },
33 "outputContract": null,
34 "datasetSchema": null,
35 "provides": [],
36 "useCases": [],
37 "repairHints": {
38 "outputProperties": {
39 "url": {
40 "type": "string",
41 "format": "uri"
42 },
43 "title": {
44 "type": "string"
45 },
46 "status": {
47 "type": "string"
48 }
49 },
50 "requiredOutputs": [
51 "url",
52 "status"
53 ],
54 "capabilities": [
55 "web-metadata-extraction"
56 ],
57 "useCases": [
58 {
59 "slug": "extract-page-metadata",
60 "title": "Extract metadata from a webpage",
61 "description": "Extract structured metadata from a public webpage.",
62 "seoTitle": "Extract Webpage Metadata as JSON",
63 "seoDescription": "Turn public webpage URLs into structured metadata records for APIs and AI agents.",
64 "searchIntents": [
65 "extract webpage metadata"
66 ],
67 "exampleInput": {
68 "urls": [
69 "https://example.com"
70 ]
71 },
72 "visibleInputFields": [
73 "urls"
74 ],
75 "datasetView": "overview"
76 }
77 ]
78 }
79 }
80 ]
81};
82
83
84const run = await client.actor("skilled_glee/echoempire-machine-foundry-1").call(input);
85
86
87console.log('Results from dataset');
88console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
89const { items } = await client.dataset(run.defaultDatasetId).listItems();
90items.forEach((item) => {
91 console.dir(item);
92});
93
94