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.
- Stealthy browser automation via
playwright-extrawith 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
.envediting 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.
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
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/httpmodules — 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").
- Node.js 18+
- npm 9+
- Playwright browsers installed
npm install
npx playwright install chromiumYou 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_hereAlternatively, you can manually copy .env.example and edit it:
cp .env.example .envNODEMAVEN_APIKEY=your_nodemaven_api_key_herenpm run scrape -- -q "ai" -p 3npm run buildNote on Terminals: In standard terminals (Bash, CMD, zsh), use
npm start -- [flags]. In Windows PowerShell, use the includedrun.ps1wrapper which handles argument passing correctly:
Bash / CMD:
npm start -- -q "fintech" -p 2PowerShell:
.\run.ps1 -q "fintech" -p 2| 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 -- --helpor.\run.ps1 --help)
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"
The scraper applies proxy configuration in the following order:
--proxyCLI argument (highest priority) — use any HTTP/SOCKS5 proxy URL directly.--apikeyCLI argument — initialize NodeMaven SDK with this key.NODEMAVEN_APIKEYenvironment variable — fallback for NodeMaven.- Direct connection (no proxy) — when no proxy configuration is found.
npm testTests 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.
npm run buildMIT