Skip to content

Getting Started

Installation

As a Library

# From PyPI (stable)
uv add perplexity-webui-scraper

# With interactive CLI token tool
uv add perplexity-webui-scraper[cli]

# From GitHub prod branch (latest features and fixes)
uv add git+https://github.com/henrique-coder/perplexity-webui-scraper.git@prod

# From GitHub prod branch with CLI extra
uv add "perplexity-webui-scraper[cli] @ git+https://github.com/henrique-coder/perplexity-webui-scraper.git@prod"

As MCP Server

No installation required — uvx handles everything automatically:

# From PyPI (stable)
uvx --from perplexity-webui-scraper[mcp]@latest perplexity-webui-scraper-mcp

# From GitHub prod branch (latest fixes)
uvx --from "perplexity-webui-scraper[mcp]@git+https://github.com/henrique-coder/perplexity-webui-scraper.git@prod" perplexity-webui-scraper-mcp

# From local directory (for development)
uv --directory /path/to/perplexity-webui-scraper run perplexity-webui-scraper-mcp

As API Server (OpenAI-compatible)

# Install with api extra
uv add "perplexity-webui-scraper[api]"

# Start the server — no token needed at startup
perplexity-webui-scraper-api

# Custom host and port
perplexity-webui-scraper-api --host 0.0.0.0 --port 8080

Authentication is done per-request via Authorization: Bearer <session_token>, exactly like the OpenAI API.

Requirements

  • Perplexity Pro or Max account
  • Session token (__Secure-next-auth.session-token cookie)

Getting Your Session Token

Option 1: Automatic (CLI Tool)

The library includes an interactive tool to fetch your token via email magic link or verification code.

# Using the library if you installed with [cli]
uv run get-perplexity-session-token

# Running standalone without adding to your project (via uvx)
uvx --from perplexity-webui-scraper[cli] get-perplexity-session-token

# Running standalone directly from GitHub prod branch
uvx --from "perplexity-webui-scraper[cli]@git+https://github.com/henrique-coder/perplexity-webui-scraper.git@prod" get-perplexity-session-token

This interactive tool will:

  1. Ask for your Perplexity email
  2. Send a verification code to your email
  3. Accept either a 6-digit code or magic link
  4. Extract and display your session token
  5. Optionally save it to your .env file

Option 2: Manual (Browser)

  1. Log in at perplexity.ai
  2. Open DevTools (F12) → Application/Storage → Cookies
  3. Copy the value of __Secure-next-auth.session-token
  4. Store in .env: PERPLEXITY_SESSION_TOKEN="your_token"