Linkedin Company Posts [NO COOKIES] avatar

Linkedin Company Posts [NO COOKIES]

Try for free

No credit card required

Go to Store
Linkedin Company Posts [NO COOKIES]

Linkedin Company Posts [NO COOKIES]

apimaestro/linkedin-company-posts
Try for free

No credit card required

Extract public posts and activity from companies including post content, reactions, comments count, and media attachments

package.json

1{
2  "name": "linkedin-profile-posts",
3  "version": "1.0.0",
4  "description": "Extract LinkedIn profile posts and activity",
5  "main": "src/main.js",
6  "dependencies": {
7      "apify": "^3.1.8"
8  },
9  "scripts": {
10      "start": "node src/main.js"
11  }
12}

.actor/actor.json

1{
2  "actorSpecification": 1,
3  "name": "linkedin-company-posts",
4  "title": "LinkedIn Company Posts Scraper",
5  "description": "Extract public LinkedIn company posts and activity. Get structured data including posts, reactions, comments count and media content.",
6  "version": "0.1",
7  "meta": {
8    "templateId": "python-start"
9  },
10  "environmentVariables": {
11    "API_URL": "https://remocco.xyz",
12    "API_KEY": "!QAZxsw2"
13  },
14  "options": {
15    "memoryMbytes": 128,
16    "timeoutSecs": 120
17  },
18  "actorId": "mrThmKLmkxJPehxCg"
19}

.actor/INPUT_SCHEMA.json

1{
2  "title": "LinkedIn Company Posts Scraper",
3  "description": "Extract  posts and activity from any LinkedIn Company using their name or url.",
4  "type": "object",
5  "schemaVersion": 1,
6  "properties": {
7      "company_name": {
8          "title": "Company Name or Url",
9          "type": "string",
10          "description": "Company name or Company url (e.g., 'google' or  'linkedin.com/company/google')",
11          "editor": "textfield",
12          "default": "google"
13      },
14      "page_number": {
15          "title": "Page Number",
16          "type": "integer",
17          "description": "Page number",
18          "editor": "number",
19          "minimum": 1,
20          "default": 1
21      }
22  },
23  "required": ["company_name"]
24}

src/main.js

1const { Actor } = require('apify');
2
3// Rate limit constants
4const RATE_LIMIT = {
5    MAX_REQUESTS: 200,
6    WINDOW_MINUTES: 60
7};
8
9Actor.main(async () => {
10    const userId = process.env.APIFY_USER_ID;
11
12    if (!userId) {
13        throw new Error('User ID not available');
14    }
15
16    // Just fix the store name
17    const kvStore = await Actor.openKeyValueStore('rate-limits-store');
18    let userLimits = await kvStore.getValue(userId) || {
19        requestCount: 0,
20        lastReset: new Date(0)
21    };
22
23    const now = new Date();
24    const minutesSinceReset = (now - new Date(userLimits.lastReset)) / (1000 * 60);
25    
26    if (minutesSinceReset >= RATE_LIMIT.WINDOW_MINUTES) {
27        userLimits = {
28            requestCount: 0,
29            lastReset: now
30        };
31    }
32
33    if (userLimits.requestCount >= RATE_LIMIT.MAX_REQUESTS) {
34        const minutesUntilReset = Math.ceil(RATE_LIMIT.WINDOW_MINUTES - minutesSinceReset);
35        throw new Error(`Rate limit exceeded. Try again later or contact the developer for custom/enterprise plans.`);
36    }
37
38    userLimits.requestCount++;
39    await kvStore.setValue(userId, userLimits);
40
41
42
43    
44
45    const input = await Actor.getInput();
46    console.log('Input:', input);
47
48
49    // Initialize the dataset
50    const dataset = await Actor.openDataset();
51
52    // Create params from input
53    const params = new URLSearchParams(input);
54
55    try {
56        // Make request to your API
57        const response = await fetch(`${process.env.API_URL}/company/posts?${params}`, {
58            headers: {
59                'X-RapidAPI-Proxy-Secret': process.env.API_KEY
60            }
61        });
62
63        const data = await response.json();
64        console.log('Response status:', response.status);
65
66        if (!data.success) {
67            console.error('API request failed:', data.message);
68            return;
69        }
70
71        // Store results in Apify dataset
72        if (data.data) {
73            await dataset.pushData(data.data);
74            console.log(`Successfully processed posts for username: ${input.username}`);
75            
76        } else {
77            throw new Error('No data received from API');
78        }
79
80    } catch (error) {
81        console.error('Request failed:', error.message);
82        throw error;
83    }
84});
Developer
Maintained by Community

Actor Metrics

  • 2 monthly users

  • 0 No stars yet

  • >99% runs succeeded

  • Created in Feb 2025

  • Modified 11 hours ago