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 "https://upload.wikimedia.org/wikipedia/commons/thumb/4/46/F._Scott_Fitzgerald%2C_The_Great_Gatsby%2C_1925%2C_title_page.jpg/960px-F._Scott_Fitzgerald%2C_The_Great_Gatsby%2C_1925%2C_title_page.jpg",
13 "https://upload.wikimedia.org/wikipedia/commons/thumb/3/3b/A_Few_Notes_on_Cruelty_to_Animals_%28title_page%29.png/960px-A_Few_Notes_on_Cruelty_to_Animals_%28title_page%29.png",
14 "https://upload.wikimedia.org/wikipedia/commons/thumb/2/22/On_the_Origin_of_Species_1859_-_Titlepage.png/960px-On_the_Origin_of_Species_1859_-_Titlepage.png"
15 ],
16 "urlField": "url",
17 "languages": [
18 "eng"
19 ],
20 "outputLevel": "text",
21 "minWordConfidence": 0,
22 "layout": "auto",
23 "grayscale": true,
24 "enhanceContrast": false,
25 "upscale": "auto",
26 "straighten": false,
27 "rotate": "0",
28 "dedupe": true,
29 "maxFileMegabytes": 15,
30 "respectRobotsTxt": true,
31 "requestsPerSecond": 2,
32 "maxConcurrency": 3,
33 "timeoutSecs": 30
34};
35
36
37const run = await client.actor("far003/image-ocr-text").call(input);
38
39
40console.log('Results from dataset');
41console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
42const { items } = await client.dataset(run.defaultDatasetId).listItems();
43items.forEach((item) => {
44 console.dir(item);
45});
46
47