Skip to content

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

Repository files navigation

YCombinator Company Scraper

A production-grade TypeScript CLI tool for scraping company listings from the Y Combinator Company Directory. Built with Playwright and a custom-built NodeMaven SDK for seamless proxy integration.


Features

  • Stealthy browser automation via playwright-extra with the Stealth plugin — avoids bot detection.
  • Proxy-ready out of the box:
    • Use NodeMaven residential proxies via API key.
    • Or supply any HTTP/SOCKS5 proxy URL directly for testing.
    • Falls back gracefully to a direct connection.
    • API key can be set directly from the CLI — no manual .env editing required (--set-key).
  • Custom-built NodeMaven SDK — a clean, TypeScript-typed, API v2 client built from scratch using native Node.js modules.
  • Advanced filtering — filter by --batch, --industry, --status, --hiring, --top.
  • Paginated scraping — control how many pages to scrape with --pages.
  • Structured output — Results displayed in a formatted table with colour-coded columns.
  • Markdown export — Save results as a richly formatted Markdown file with --output.
  • Full unit test coverage for the SDK, scraper and Markdown exporter using Jest and ts-jest.

Project Architecture

ycombinator-scraper/
├── sdk/                         # Custom @nodemaven/sdk implementation
│   ├── index.js                 # NodeMavenClient + error classes
│   ├── index.d.ts               # TypeScript type declarations
│   └── package.json             # Local npm package definition
├── src/
│   ├── cli.ts                   # Commander CLI entry point
│   ├── scraper/
│   │   ├── browser-setup.ts     # Playwright + proxy initialization
│   │   └── extractor.ts         # Scraping and pagination logic
│   ├── output/
│   │   └── markdown.ts          # Markdown export formatter
│   ├── types/
│   │   └── puppeteer-extra-plugin-stealth.d.ts
│   └── __tests__/
│       ├── sdk.test.ts          # Jest unit tests for the SDK
│       ├── extractor.test.ts    # Unit tests for the scraper/extractor
│       └── markdown.test.ts     # Unit tests for the Markdown exporter
├── .env.example
├── .gitignore
├── jest.config.js
├── tsconfig.json
└── package.json

Custom NodeMaven SDK (sdk/)

The @nodemaven/sdk package is implemented in place because the official package is not publicly available on npm. The custom implementation:

  • Communicates with the NodeMaven REST API v2 at https://dashboard.nodemaven.com.
  • Uses the standard Node.js https/http modules — zero runtime dependencies.
  • Provides typed semantic error classes: AuthenticationError, ValidationError, RateLimitError, ServerError, NotFoundError.
  • Dynamically constructs proxy usernames to enable geo-targeting, sticky sessions, ISP targeting, and ZIP-code targeting.
  • Linked as a local file dependency in package.json ("@nodemaven/sdk": "file:./sdk").

Getting Started

Prerequisites

  • Node.js 18+
  • npm 9+
  • Playwright browsers installed

Installation

npm install
npx playwright install chromium

Configuration

You can easily set your API key right from the CLI. This will automatically create or update your .env file:

npm run scrape -- --set-key your_nodemaven_api_key_here

Alternatively, you can manually copy .env.example and edit it:

cp .env.example .env
NODEMAVEN_APIKEY=your_nodemaven_api_key_here

Usage

Run via ts-node (development)

npm run scrape -- -q "ai" -p 3

Run compiled build (production)

npm run build

Note on Terminals: In standard terminals (Bash, CMD, zsh), use npm start -- [flags]. In Windows PowerShell, use the included run.ps1 wrapper which handles argument passing correctly:

Bash / CMD:

npm start -- -q "fintech" -p 2

PowerShell:

.\run.ps1 -q "fintech" -p 2

CLI Options

Option Alias Description Default
--query <string> -q Search query (e.g. "ai", "fintech") (required)
--pages <number> -p Number of pages to scrape 1
--batch <string> — Filter by YC batch (e.g. W24, S23) —
--industry <string> — Filter by industry (e.g. Fintech, B2B) —
--status <string> — Filter by status: Active, Public, Acquired, Inactive —
--hiring — Only show companies currently hiring —
--top — Only show YC Top Companies —
--output <path> -o Save results to a Markdown file —
--apikey <string> -a NodeMaven API Key (overrides .env) —
--set-key <key> — Save NodeMaven API key to .env —
--show-key — Show currently saved API key (masked) —
--clear-key — Remove API key from .env —
--proxy <string> — Custom proxy URL for testing —

💡 Tip: Discover more examples and full search parameters by running --help (npm start -- --help or .\run.ps1 --help)

Examples

1. Export formatted results to a Markdown file

  • Bash / CMD: npm start -- -q "fintech" -p 2 -o results.md
  • PowerShell: .\run.ps1 -q "fintech" -p 2 -o results.md

2. Filter by industry and batch

  • Bash / CMD: npm start -- --industry "Healthcare" --batch "W24"
  • PowerShell: .\run.ps1 --industry "Healthcare" --batch "W24"

3. Manage your NodeMaven API key

  • Bash / CMD:
    npm start -- --set-key nm_your_key_here    # Save key to .env
    npm start -- --show-key                    # Verify it was saved
    npm start -- --clear-key                   # Remove it from .env
  • PowerShell:
    .\run.ps1 --set-key nm_your_key_here
    .\run.ps1 --show-key
    .\run.ps1 --clear-key

4. Scrape using a custom proxy

  • Bash / CMD: npm start -- -q "health" --proxy http://user:pass@proxy.example.com:8080
  • PowerShell: .\run.ps1 -q "health" --proxy http://user:pass@proxy.example.com:8080

5. Run without proxy (direct connection)

  • Bash / CMD: npm start -- -q "open source"
  • PowerShell: .\run.ps1 -q "open source"

Proxy Priority

The scraper applies proxy configuration in the following order:

  1. --proxy CLI argument (highest priority) — use any HTTP/SOCKS5 proxy URL directly.
  2. --apikey CLI argument — initialize NodeMaven SDK with this key.
  3. NODEMAVEN_APIKEY environment variable — fallback for NodeMaven.
  4. Direct connection (no proxy) — when no proxy configuration is found.

Development

Run tests

npm test

Tests cover:

  • Client constructor with config options and environment variable fallback.
  • Proxy URL/config generation including full geo-targeting parameter strings.
  • Semantic error class hierarchy and status code mapping.
  • Mocked HTTP request handling and error propagation.

Build

npm run build

License

MIT

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages