Use LinkedIn Company Page Post & Engagement Extractor with Python
Pull posts from any LinkedIn company page with captions, media, article links, hashtags, mentions, and reaction/comment/repost counts, filterable by date and engagement.
1. Choose the data you need
Review the published README for supported collection modes, examples, and limits. The recipe below uses the current published input definition.
2. Prepare a source-based input
This JSON contains published prefills and required-field defaults. Review every value for your task before running it; it is not a promise of successful collection.
{
"companyUrls": [
"https://www.linkedin.com/company/hubspot/"
],
"datePosted": "",
"hydratePosts": true,
"includeDocumentDetails": false,
"includeEmployeePosts": false,
"includeIndexedPosts": false,
"includeReactionBreakdown": false,
"includeReposts": true,
"language": "en",
"maxPostsPerCompany": 2,
"minComments": 0,
"minReactions": 0,
"mode": "auto",
"monitorMode": false,
"sortBy": "recent"
}
Download input.example.json and save your reviewed copy as input.json.
| Field | Type | Required | Description |
|---|---|---|---|
mode | string | optional | What to scrape. "Auto" uses the targets you provide; the actor picks the right pipeline automatically. |
companyUrls | array | optional | LinkedIn company pages to scrape. Accepts full URLs (https://www.linkedin.com/company/hubspot/), a posts URL, or just the slug (hubspot). |
postUrls | array | optional | Specific LinkedIn post links to extract (any format: /posts/...-activity-..., share, ugcPost, or /feed/update/urn:li:...). Used in the "Specific post URLs" mode. |
maxPostsPerCompany | integer | optional | Maximum posts to return per company. LinkedIn itself stops a company's post history at 500 posts and one year; deeper older posts are reachable only through the public search index. |
postTypes | array | optional | Which post media types to keep. Leave empty to keep every type. |
includeEmployeePosts | boolean | optional | The public company page mixes a few featured employee posts into its recent feed. Turn this on to include them; off returns the company's own posts (including its showcase/sub-brand pages) only. |
includeIndexedPosts | boolean | optional | Also search the public web index for older company-authored posts. This finds more posts than the company page shows, but coverage depends on the search index. |
datePosted | string | optional | Keep only posts published within this window. Applied to each post's real publish date. |
postedAfter | string | optional | Only posts published on or after this date. Accepts YYYY-MM-DD or an ISO date-time. |
postedBefore | string | optional | Only posts published on or before this date. Accepts YYYY-MM-DD or an ISO date-time. |
minReactions | integer | optional | Skip posts with fewer than this many reactions. |
minComments | integer | optional | Skip posts with fewer than this many comments. |
sortBy | string | optional | How to order the returned posts. Recent = newest first, Popular = most reactions first. |
includeReposts | boolean | optional | Whether to include reposts (posts the company reshared from someone else). |
hydratePosts | boolean | optional | Open each post's public page for the full text, exact publish time, top comments and media. Turn off for a faster, lighter run. |
includeReactionBreakdown | boolean | optional | Also return the per-reaction-type breakdown and the repost (share) count when LinkedIn serves the richer public layout. Slightly slower. |
includeDocumentDetails | boolean | optional | For document (PDF/PPTX) posts, also return the original PDF link, page images and the per-page text transcript. |
monitorMode | boolean | optional | Return only posts that were not returned by a previous run with the same settings. Useful for scheduled monitoring. |
language | string | optional | Preferred content language used when requesting LinkedIn pages. |
cookie | string | optional | Kept for backward compatibility with older saved tasks. The actor is 100% cookieless; any value here is ignored. |
3. Start an Actor run
Set APIFY_TOKEN in your environment. Python 3.10 or newer is sufficient; this recipe uses no third-party packages.
Execution may incur charges. Review current pricing on Apify. The request asks for a 120-second timeout and a charge limit; these settings are subject to Apify’s pricing and do not guarantee an all-inclusive spending cap.
import json
import os
import urllib.request
# Save the schema-derived example as input.json; review and edit it first.
with open("input.json", encoding="utf-8") as stream:
actor_input = json.load(stream)
token = os.environ["APIFY_TOKEN"]
request = urllib.request.Request(
"https://api.apify.com/v2/acts/B19O7L63i7a0To0oh/runs?timeout=120&maxTotalChargeUsd=0.50",
data=json.dumps(actor_input).encode("utf-8"),
headers={"Authorization": "Bearer " + token, "Content-Type": "application/json"},
method="POST",
)
# This starts a potentially billable run. Do not automatically retry this POST.
with urllib.request.urlopen(request, timeout=40) as response:
run = json.load(response)["data"]
print("Run ID:", run["id"])
print("Status:", run["status"])
# Inspect and download results in Apify Console once the run succeeds.
4. Inspect the actual results
Open the run in Apify Console and wait for a successful completion. Use the published output schema to locate results and the dataset schema to understand declared views. Missing or optional record fields must not be treated as guaranteed values.
LinkedIn company page posts with captions, media, article links, hashtags, mentions, engagement counts, top comments and document details.
Questions before you run
Which inputs are required?
No top-level fields are marked required in the published schema. Conditional requirements can still apply; check the README.
What does this guide verify?
The fields, prefills, and schema links are rendered from the published build. This is a usage recipe, not a paid live extraction test. Source availability and collection results can vary.
What if the run request times out?
Check Apify Console before retrying. The first request may already have created a run. Do not automatically repeat a run-creation POST.
Generated from source build dfsyX9J6qz6on8sQY and its README and schemas. Source changes regenerate this guide; no third-party editorial claims are inferred.