Skip to main content

A LinkedIn data extraction toolkit for scraping skills, experience and more.

Project description

LinkedIn Skill Scraper

A Python-based tool to scrape skills from LinkedIn profile skills pages using dynamic content loading detection. The scraper intelligently waits for content to load rather than using fixed delays, making it faster and more reliable.

Python 3.7+ License: MIT

Features

  • 🔍 Smart Content Detection - Dynamically waits for skills to load instead of fixed delays
  • 🤖 Automated Browser Control - Uses Selenium for reliable scraping
  • 📊 Proper Logging - Track scraping progress with configurable logging levels
  • 🛠️ CLI & Programmatic API - Use as command-line tool or import as library
  • 💾 Flexible Output - Save to text files or use in your code
  • 🔒 Secure - No hardcoded credentials, supports environment variables
  • 📄 HTML Parsing - Can parse saved HTML files without logging in

Installation

Option 1: Clone Repository (Recommended for GitHub)

git clone https://github.com/yourusername/linkedin-skill-scraper.git
cd linkedin-skill-scraper
pip install -r requirements.txt

Option 2: Install as Package

pip install -e .

This allows you to import the package from anywhere:

from linkedin_skill_scraper import LinkedInSkillScraper

Usage

Command Line Interface

Interactive Mode

Simply run without arguments for interactive prompts:

python linkedin_skill_scraper.py

Command Line Arguments

python linkedin_skill_scraper.py <profile> --email <email> --password <password> [options]

Arguments:

  • profile - LinkedIn profile username (e.g., kristian-julsgaard)
  • --email - Your LinkedIn email
  • --password - Your LinkedIn password
  • --headless - Run browser in headless mode (no GUI)
  • --output - Output filename (default: skills.txt)
  • --save-html - Save HTML for debugging
  • --debug - Enable debug logging

Example:

python linkedin_skill_scraper.py kristian-julsgaard \
  --email your_email@example.com \
  --password your_password \
  --headless \
  --output kristian_skills.txt \
  --debug

Programmatic Usage (Import as Library)

Basic Example

from linkedin_skill_scraper import LinkedInSkillScraper

# Initialize scraper
scraper = LinkedInSkillScraper(headless=False, debug=False)

try:
    # Setup and login
    scraper.setup_driver()
    scraper.login("your_email@example.com", "your_password")
    
    # Scrape skills
    skills = scraper.scrape_skills("kristian-julsgaard")
    
    # Use the skills list
    print(f"Found {len(skills)} skills:")
    for skill in skills:
        print(f"  - {skill}")
    
    # Save to file
    scraper.save_skills(skills, "output.txt")
    
finally:
    scraper.close()

Batch Scraping Multiple Profiles

from linkedin_skill_scraper import LinkedInSkillScraper
import time

profiles = ["profile1", "profile2", "profile3"]
scraper = LinkedInSkillScraper(headless=True)

try:
    scraper.setup_driver()
    scraper.login(email, password)
    
    all_skills = {}
    for profile in profiles:
        skills = scraper.scrape_skills(profile)
        all_skills[profile] = skills
        time.sleep(5)  # Be respectful to LinkedIn servers
        
finally:
    scraper.close()

See the examples/ directory for more usage patterns.

Parse Saved HTML (No Login Required)

If you have saved the HTML of a LinkedIn skills page:

python scrape_from_html.py skills_page.html

How It Works

Smart Dynamic Loading

Unlike traditional scrapers that use fixed delays, this scraper:

  1. Monitors Content Loading - Actively counts skill elements as they appear
  2. Detects Stability - Waits until no new skills load for several checks
  3. Intelligent Scrolling - Only scrolls when new content is detected
  4. Adaptive Timing - Moves quickly when content loads fast, waits longer when slow

This makes it more reliable with LinkedIn's variable page load times and throttling.

HTML Structure

The scraper identifies skills by finding <li> elements with IDs containing profilePagedListComponent and extracting text from <span aria-hidden="true"> elements.

API Reference

LinkedInSkillScraper Class

Constructor

LinkedInSkillScraper(headless=False, debug=False)

Parameters:

  • headless (bool): Run browser without GUI
  • debug (bool): Enable debug logging

Methods

setup_driver()

  • Sets up Chrome WebDriver

login(email, password)

  • Login to LinkedIn
  • Raises Exception if login fails

scrape_skills(profile_url, save_html=False)

  • Scrapes skills from a profile
  • profile_url: Username or full URL
  • save_html: Save page HTML for debugging
  • Returns: List of skill names

save_skills(skills, filename='skills.txt')

  • Saves skills to a text file
  • skills: List of skill names
  • filename: Output file path

close()

  • Closes the browser (always call in finally block)

Configuration

Using Environment Variables

For security, use environment variables instead of hardcoding credentials:

import os
from linkedin_skill_scraper import LinkedInSkillScraper

email = os.getenv('LINKEDIN_EMAIL')
password = os.getenv('LINKEDIN_PASSWORD')

scraper = LinkedInSkillScraper()
scraper.setup_driver()
scraper.login(email, password)

Set variables:

export LINKEDIN_EMAIL="your_email@example.com"
export LINKEDIN_PASSWORD="your_password"

Requirements

  • Python 3.7+
  • Chrome browser
  • LinkedIn account

See requirements.txt for Python dependencies.

Output Format

Skills are saved as plain text, one per line:

Python
JavaScript
React
Machine Learning
Data Analysis

Important Considerations

⚠️ LinkedIn Terms of Service: Automated scraping may violate LinkedIn's Terms of Service. Use responsibly:

  • Only scrape public profiles or those you have permission to access
  • Add delays between requests (use time.sleep() in batch operations)
  • Respect LinkedIn's rate limits
  • Consider using the HTML parsing method for personal/educational use

⚠️ Rate Limiting: LinkedIn may throttle or block repeated automated requests. The scraper includes:

  • User-agent spoofing
  • Automation detection avoidance
  • Smart waiting (less suspicious than fixed delays)

⚠️ Privacy: Be respectful of privacy and only scrape publicly available information.

Troubleshooting

"No skills found"

  • Ensure the profile has public skills
  • Check that you're logged in successfully
  • Try running with --save-html to inspect the HTML
  • Enable debug mode with --debug

ChromeDriver issues

  • The scraper auto-downloads ChromeDriver via webdriver-manager
  • Ensure Chrome browser is installed
  • Check Chrome and ChromeDriver versions match

Login fails

  • Verify credentials are correct
  • LinkedIn may require 2FA or CAPTCHA (run in non-headless mode to complete)
  • Try logging in manually in the browser first

Skills load slowly or incompletely

  • The dynamic waiting should handle this automatically
  • If issues persist, check your internet connection
  • LinkedIn may be throttling - add longer delays

Development

Running Tests

# Install dev dependencies
pip install -e ".[dev]"

# Run tests
pytest tests/

Contributing

Contributions are welcome! Please:

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Submit a pull request

License

MIT License - see LICENSE file for details.

Disclaimer

This tool is for educational purposes only. The authors are not responsible for misuse or any violations of LinkedIn's Terms of Service. Use at your own risk and always respect LinkedIn's policies and user privacy.

Changelog

v1.0.0 (2025-10-07)

  • Initial release
  • Dynamic content loading detection
  • CLI and programmatic interfaces
  • Proper logging
  • Batch scraping support
  • HTML parsing mode

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

linkedin_extractor-0.1.4.tar.gz (9.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

linkedin_extractor-0.1.4-py3-none-any.whl (10.5 kB view details)

Uploaded Python 3

File details

Details for the file linkedin_extractor-0.1.4.tar.gz.

File metadata

  • Download URL: linkedin_extractor-0.1.4.tar.gz
  • Upload date:
  • Size: 9.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.18

File hashes

Hashes for linkedin_extractor-0.1.4.tar.gz
Algorithm Hash digest
SHA256 fbc7f1102cd56c24e3408bcdb5ae4d0951ef266a799343b1f48ccb7f665a97cf
MD5 ed730908c79dccdb46225de67ce5c104
BLAKE2b-256 7806d9066505fa4f380ef3546e56fc8f7e69a3d1425815f090857e675cbb8934

See more details on using hashes here.

File details

Details for the file linkedin_extractor-0.1.4-py3-none-any.whl.

File metadata

File hashes

Hashes for linkedin_extractor-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 9e857d89172513b35f8a11351fa6260e7a9c8bb8113718d64c8b341d6c2beb3c
MD5 b253af5b3a6bca7faa244fabe9e1c261
BLAKE2b-256 90ff736286b48d935bed4453ebaa6830a5e49f4e9b0c53173628f41f6e43b88e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page