How priezz/linkedin-email-extractor works
Project type and purpose
• This is a Node.js command-line tool (a backend-only “script” application), whose sole purpose is to read your LinkedIn connections CSV, log into LinkedIn in a headless browser, scrape each contact’s page for their email address, and update the CSV in place.
File structure
• Top-level files only:
• index.js – the entire orchestration (CLI prompts, CSV I/O, browser automation, scraping logic).
• package.json – lists dependencies (likely Puppeteer or a request/cheerio combo, a CSV parser, readline or inquirer for prompts).
• README.md – usage instructions.
• .gitignore – standard ignores (node_modules, .env if any).
• There are no multi-service components or front-end artifacts—this is a single Node process.
README for additional insights
• The README explains:
• You supply “Connections.csv” exported from LinkedIn.
• It prompts for your LinkedIn credentials.
• It asks which UI version (“old” vs “new”) you have.
• It then cycles through contacts, scraping with DOM selectors that may differ by UI version, and updates the CSV row-by-row.
• It warns about rate-limiting and the need to restart the script manually.
• CLI Interface Module
– Reads Connections.csv (File System)
– Prompts for credentials & UI version
• Scraper Module
– Launches headless browser (Puppeteer or similar)
– Navigates to LinkedIn, logs in
– Iterates through each profile page
– Applies version-specific DOM selectors
• Data Processor / CSV Module
– Parses CSV, appends/updates rows with discovered emails
– Writes back to Connections.csv
• External Service
– LinkedIn (the web application endpoint)
b. Relationships and data flows
1. User invokes yarn start → CLI Module
2. CLI reads Connections.csv → sends list of profile URLs to Scraper Module
3. Scraper Module ↔ LinkedIn over HTTP/HTTPS via headless browser
4. Scraper returns parsed email data → Data Processor Module
5. Data Processor writes updated rows → Connections.csv
c. Architectural patterns / design principles
• Single-process, event-driven Node.js application.
• Separation of concerns:
• CLI & user prompts
• Browser automation & scraping logic
• CSV parsing & file I/O
• Runtime branching based on UI version for selector differences.
d. Key technologies & libraries
• Node.js (v10+ implied)
• Puppeteer (or request + cheerio, depending on package.json)
• csv-parse / csv-stringify (or similar)
• readline or inquirer for interactive prompts
• fs module for file I/O
Detail
• Error-handling or restart loop as a note: “On rate-limit, restart script.”