# How to scrape LinkedIn with Python: jobs, companies, posts

> A free 408-line Python script scrapes public LinkedIn jobs, companies and posts with no login. It read 100 jobs in 26 to 30 seconds.

- URL: https://toolzerhub.com/blog/how-to-scrape-linkedin
- Published: 2026-10-17
- Publisher: ToolzerHub (we sell the API this post describes)

## Short answer

- One Python file with curl_cffi and BeautifulSoup reads public LinkedIn company pages, jobs, job postings, posts and profiles with no login or API key, and read 100 jobs in 26 to 30 seconds.
- The script cannot read the LinkedIn Ad Library, a company's recent updates or its affiliated pages. It returns jobs 10 per request and a job page's pay and description.
- ToolzerHub's LinkedIn API reads the Ad Library at 1 credit a call, 24 ads a call and 26,217 matches for Microsoft. A 20-ad CSV for Shopify cost 22 credits.

You can scrape public LinkedIn jobs, company pages, posts and profiles with one Python file and no login: our free script [toolzerhub/linkedin-scraper](https://github.com/toolzerhub/linkedin-scraper) on GitHub. It is 408 lines and uses two packages, `curl_cffi` and BeautifulSoup. It read a company page in 1.5 seconds and 100 jobs in 26 to 30 seconds.

## Set up the LinkedIn scraper

Clone the repo, install the two packages and run `company` on a public company name. No browser runs, and every command takes `-o file.json`. Jobs come from the HTML fragments LinkedIn's logged-out job pages load; company, profile and post pages are read through their `application/ld+json` block.

```bash
git clone https://github.com/toolzerhub/linkedin-scraper.git
cd linkedin-scraper
pip install -r requirements.txt
python linkedin_scraper.py company nasa
```

## Scrape a LinkedIn company page

Run `company` with a name from the page's URL. It returns industry, size, headquarters, website, specialties, address, follower and employee counts and similar pages. Trimmed output for NASA (`founded` is null because its page lists no year):

```json
{
  "slug": "nasa",
  "company_id": "2003",
  "name": "NASA - National Aeronautics and Space Administration",
  "industry": "Aviation and Aerospace Component Manufacturing",
  "website": "http://www.nasa.gov",
  "company_size": "10,001+ employees",
  "employee_count": 53106,
  "followers_count": 7140505,
  "type": "Government Agency",
  "founded": null,
  "headquarters": "Washington, DC",
  "address": { "street": "300 E Street SW", "city": "Washington", "region": "DC", "postal_code": "20546", "country": "US" },
  "similar_companies": ["spacex", "tesla-motors", "jet-propulsion-laboratory", "european-space-agency"]
}
```

## Search LinkedIn jobs with Python

Run `jobs` with keywords, `--location` and `--limit`. It returns title, company, location, post date and an "Actively Hiring" flag for each job, 10 per request.

```json
[
  {
    "job_id": "4476590411",
    "title": "Data Analyst",
    "company": "Searchability NS&D",
    "company_url": "https://www.linkedin.com/company/searchability-ns-d",
    "location": "London Area, United Kingdom",
    "posted_date": "2026-10-07",
    "salary": null,
    "actively_hiring": true
  }
]
```

`salary` was null on all 300 London jobs we saved, because search cards carry no pay. The job page does: `job 4476590411` returned "£37,000.00/yr - £60,000.00/yr" with the description, seniority, employment type and applicant hint, in 0.4 and 0.7 seconds. Seek's search cards do carry pay when the advertiser lists it: 98 of 148 Brisbane electrician ads in [our Seek run](https://toolzerhub.com/blog/seek-api).

## How many jobs one command returns

A command returns up to 998 jobs for `--limit 1000`, and it keeps the jobs it has if a page request fails. `--limit 100` took 26 to 30 seconds, `--limit 300` took 71.9 to 81.1 seconds and a 998-job run took 271.0 seconds, most of it the script's own 2-second wait between requests.

## Posts and profiles

`post <url>` returns the text, date, author and like and comment counts; `--comments` adds the first page of comments, 8 of one post's 617. `profile <name>` returns the name, headline, about text, followers, work history, education and a few recent posts: 3 work-history entries, 1 school and 8 recent posts for the profile we read.

## LinkedIn ads and more with ToolzerHub

The free script cannot read the LinkedIn Ad Library, a company's recent updates or its affiliated pages. We make ToolzerHub, and its [LinkedIn API](https://toolzerhub.com/apis/linkedin) returns them with one API key. This request asks for ads from advertisers matching "Microsoft":

```bash
curl -H "x-api-key: $TOOLZERHUB_API_KEY" \
  "https://api.toolzerhub.com/v1/linkedin/ads/search?account_owner=Microsoft"
```

It returned 24 ad cards and a `match_count` of 26,217; the filter matches advertiser names containing the word, partners included. A card has an id, format and thumbnail. `ads/detail` returns the copy, payer, run dates, impression band and targeting. Trimmed to one ad:

```json
{
  "ad_id": "1573006783",
  "ad_format": "Single Image Ad",
  "advertiser": "Microsoft",
  "paid_for_by": "ZENITH UK (MEDIA) LIMITED",
  "run_dates": "Ran from Oct 7, 2026 to Oct 17, 2026",
  "headline": "DTI Group liefert hochpräzise Process Intelligence mit Azure AI",
  "total_impressions": "1k-5k",
  "targeting": { "segments": [
    { "parameter": "Language", "mode": "include", "summary": "Targeting includes Deutsch" },
    { "parameter": "Location", "mode": "include", "summary": "Targeting includes Deutschland, Österreich" }
  ] }
}
```

Some ads carry only the payer, with no dates or targeting: 3 of the first 10 for Microsoft. Send each `pagination_token` to `ads/search/pagination` with the same filters. The script below reads two pages, opens the first 20 ads and writes a CSV.

```python
import csv
import os
import sys

import requests

BASE = "https://api.toolzerhub.com/v1/linkedin"
HEADERS = {"x-api-key": os.environ.get("TOOLZERHUB_API_KEY", "")}
FIELDS = ["ad_id", "advertiser", "paid_for_by", "run_dates", "total_impressions", "ad_format", "headline", "body"]


def get(path, **params):
    """One API call, 1 credit. Tries twice on an HTTP error; None means it kept failing."""
    for attempt in range(2):
        try:
            resp = requests.get(f"{BASE}/{path}", params=params, headers=HEADERS, timeout=60)
            resp.raise_for_status()
            return resp.json()["data"]
        except requests.HTTPError:
            if attempt:
                return None


def main(advertiser, path, pages=2, details=20):
    page = get("ads/search", account_owner=advertiser)  # 24 ads a page
    ids, calls = [], 1
    for number in range(pages):
        if not page:
            break
        ids += [ad["ad_id"] for ad in page["ads"]]
        if number == pages - 1 or page["is_last_page"] or not page["pagination_token"]:
            break
        page = get("ads/search/pagination", account_owner=advertiser, pagination_token=page["pagination_token"])
        calls += 1
    ids = list(dict.fromkeys(ids))
    rows = 0
    with open(path, "w", newline="", encoding="utf-8") as f:
        out = csv.DictWriter(f, fieldnames=FIELDS, extrasaction="ignore")
        out.writeheader()
        for ad_id in ids[:details]:
            ad = get("ads/detail", ad_id=ad_id)  # the search cards carry no copy, payer or dates
            calls += 1
            if ad:
                out.writerow(ad)
                rows += 1
    print(f"{advertiser}: {len(ids)} ads found, {rows} detailed rows, {calls} calls -> {path}")


if __name__ == "__main__":
    main(sys.argv[1], sys.argv[2])
```

```bash
export TOOLZERHUB_API_KEY=your_key
python linkedin_ads.py Shopify shopify_ads.csv
```

It took 29.8 seconds:

```text
Shopify: 48 ads found, 20 detailed rows, 22 calls -> shopify_ads.csv
```

Dates were on 12 of 20 Shopify rows, 18 of 20 Microsoft and 2 of 20 HubSpot. The company route also returns 10 recent updates with reaction counts and affiliated pages, and one post gave 16 comments against the script's 8. A job search takes `start` up to 1,000 in steps of 10, and 100 calls gave 881 to 890 distinct jobs, so deduplicate by `job_id`.

## What it costs

Every call above costs 1 credit, so the Shopify run used 22 credits and a 100-call jobs walk used 100. You get 100 free credits a month; $19 buys 10,000 credits that never expire, and [plans for higher volume](https://toolzerhub.com/pricing) cover more advertisers. [Get a free API key](https://app.toolzerhub.com/signup) and run the ads script on your first advertiser.

LinkedIn's own API is covered in [what the official API costs](https://toolzerhub.com/blog/linkedin-api-pricing). The same approach for other sites is in [scraping TikTok with Python](https://toolzerhub.com/blog/how-to-scrape-tiktok) and [scraping Google Maps with Python](https://toolzerhub.com/blog/how-to-scrape-google-maps).

We are not affiliated with LinkedIn Corporation.
