1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "liPostUrl": "https://www.linkedin.com/posts/example-user_example-topic-ugcPost-1234567890123456789-example/",
12 "profileId": "example-profile-id",
13 "li_at": "example_li_at",
14 "JSESSIONID": "ajax:example",
15 "bcookie": "example_bcookie",
16 "liap": "true",
17 "li_theme_set": "app",
18 "li_theme": "light",
19 "timezone": "Asia/Kolkata",
20 "bscookie": "example_bscookie",
21 "user-agent": "Mozilla/5.0 ...",
22 "timezoneOffset": "5.5",
23 "csrf-token": "example_csrf-token",
24 "User-Agent": "Mozilla/5.0 ...",
25 "x-li-track": "{\"clientVersion\":\"1.13.455\"}",
26 "x-li-lang": "en_US",
27 "X-Restli-Protocol-Version": "2.0.0",
28 "txSmSelfProfileUrl": "https://www.linkedin.com/in/example-self/",
29 "proxy": {
30 "ip": "http://proxy.example.com",
31 "port": "1080",
32 "username": "example_username",
33 "password": "example_password"
34 }
35};
36
37
38const run = await client.actor("automationagents/linkedin-post-scraper").call(input);
39
40
41console.log('Results from dataset');
42console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
43const { items } = await client.dataset(run.defaultDatasetId).listItems();
44items.forEach((item) => {
45 console.dir(item);
46});
47
48