1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "batch_items": [
12 {
13 "text": "Hello, how are you?",
14 "source_lang": "en",
15 "target_lang": "es"
16 },
17 {
18 "text": "Bonjour tout le monde",
19 "source_lang": "fr",
20 "target_lang": "en"
21 },
22 {
23 "text": "مرحبا بالجميع",
24 "source_lang": "ar",
25 "target_lang": "de"
26 },
27 {
28 "text": "Guten Morgen",
29 "target_lang": "it"
30 }
31 ]
32};
33
34
35const run = await client.actor("maged120/google-translate-scraper").call(input);
36
37
38console.log('Results from dataset');
39console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
40const { items } = await client.dataset(run.defaultDatasetId).listItems();
41items.forEach((item) => {
42 console.dir(item);
43});
44
45