Use LinkedIn Trending Posts & Top Voices Feed Scraper with Python
Pull LinkedIn's trending and top-performing posts by topic keyword, with reaction/comment/repost counts, a per-reaction-type breakdown, author headline, and media type, so you can filter by engagement thresholds, date window, or media type.
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.
{
"dateRange": "",
"includeComments": true,
"includeVideoTranscript": false,
"maxComments": 10,
"maxDepth": "2",
"maxPosts": 3,
"maxVoices": 100,
"mediaTypeFilter": "",
"minComments": 0,
"minReactions": 0,
"mode": "topContent",
"onlyInfluencers": false,
"postUrls": [],
"postedAfter": "",
"postedBefore": "",
"sortBy": "linkedin_rank",
"startUrls": [],
"topVoiceClassUrls": [],
"topics": [
"artificial-intelligence"
]
}
Download input.example.json and save your reviewed copy as input.json.
| Field | Type | Required | Description |
|---|---|---|---|
mode | string | optional | What to scrape. 'Top Content directory' crawls LinkedIn's public curated topic pages; 'Top Voices class' reads a quarterly LinkedIn News honoree list; 'Post URLs' enriches specific public posts. |
topics | array | optional | Pick one or more Top Content topics or subtopics, or paste any /top-content/... path or URL (custom values are accepted). Topic page = ~9-10 ranked posts; subtopics add ~20 more pages each. (mode=topContent/auto) |
maxDepth | string | optional | How deep to crawl each selected topic. 2 = the topic page only (~10 posts); 3 = topic + its 20 subtopics; 4 = subtopics + their leaves (very large; use maxPosts). (mode=topContent/auto) |
startUrls | array | optional | Exact /top-content/... pages to scrape instead of expanding topics. Each page returns its ranked posts only. (mode=topContent/auto) |
postUrls | array | optional | Public LinkedIn post URLs to enrich directly: /posts/..., /feed/update/urn:li:activity|share|ugcPost:..., or country subdomains. (mode=postUrls/auto) |
topVoiceClassUrls | array | optional | LinkedIn News Top Voices class articles (/pulse/...). Leave empty to use the latest US class. (mode=topVoices/auto) |
maxVoices | integer | optional | Maximum Top Voices honorees to return after deduplication. (mode=topVoices) |
maxPosts | integer | optional | Maximum posts to deliver after deduplication, filtering and sorting. Depth 2 across one topic usually has fewer than 10 unique posts; deeper crawls have more. |
sortBy | string | optional | Order of the delivered posts. 'LinkedIn rank' preserves each page's editorial order. |
dateRange | string | optional | Only return posts published inside this window. LinkedIn Top Content is a curated archive, so 24h/7d/30d windows are often empty. |
postedAfter | string | optional | Only return posts published on or after this date (YYYY-MM-DD). |
postedBefore | string | optional | Only return posts published on or before this date (YYYY-MM-DD). |
minReactions | integer | optional | Only return posts with at least this many reactions. |
minComments | integer | optional | Only return posts with at least this many comments. |
mediaTypeFilter | string | optional | Only return posts of one media type. Public Top Content pages contain text, image, video and article posts. |
onlyInfluencers | boolean | optional | Return only posts whose author carries LinkedIn's public 'Influencer' badge. This is not the same as a Top Voices class membership. |
includeComments | boolean | optional | Attach the public comments embedded on each post page (up to maxComments). |
maxComments | integer | optional | Comments to keep per post. Public post pages embed about 10. |
includeVideoTranscript | boolean | optional | Add the transcript when a public video post publishes one. |
proxyConfiguration | object | optional | Optional proxy override. The actor works without a proxy; it only falls back to Apify's datacenter proxy if LinkedIn blocks the request. |
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/GKUGR8NfNU7naugLT/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.
Posts from LinkedIn's public Top Content directory with exact dates, authors, followers, badges, media, topic path/rank and top comments; Top Voices class honorees use the voice* fields.
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 aAKya3BezjIgnbmjm and its README and schemas. Source changes regenerate this guide; no third-party editorial claims are inferred.