How henrique-coder/perplexity-webui-scraper works
Perplexity WebUI Scraper turns a browser session token into conversational answers through Perplexity’s internal endpoints. The main workflow configures a client, checks account/model access, submits prompts (and optional files), then parses streamed responses. It also exposes that capability through a terminal chat CLI, an OpenAI-compatible REST API, and an MCP server; a separate CLI command helps obtain session tokens. Several implementation details are unsampled, so links for those paths are limited to documented capabilities or omitted.
Main entry points: core/client.py Client · conversation.py Conversation · http/client.py HTTP transport · completions.py Chat completions
Components 27
Conversation runtime
- Client
src/perplexity_webui_scraper/core/client.py - Conversation
src/perplexity_webui_scraper/core/conversation.py - Account access
src/perplexity_webui_scraper/core/account.py - File uploads
src/perplexity_webui_scraper/core/files.py - Stream parser
src/perplexity_webui_scraper/core/parser.py - Response data
src/perplexity_webui_scraper/core/response.py - Request payload
src/perplexity_webui_scraper/core/payload.py
HTTP and models
- HTTP transport
src/perplexity_webui_scraper/http/client.py - Browser fingerprint
src/perplexity_webui_scraper/http/fingerprint.py - Retry and limits
src/perplexity_webui_scraper/http/resilience.py - Model registry
src/perplexity_webui_scraper/models/registry.py - Model metadata
src/perplexity_webui_scraper/models/types.py
REST API
- Chat completions
src/perplexity_webui_scraper/api/routes/completions.py - Model listing
src/perplexity_webui_scraper/api/routes/models.py - Bearer authentication
src/perplexity_webui_scraper/api/auth.py - Thread cache
src/perplexity_webui_scraper/api/conversation_cache.py - Request mapping
src/perplexity_webui_scraper/api/helpers.py - REST application
src/perplexity_webui_scraper/api/app.py
User interfaces
- Interactive chat
src/perplexity_webui_scraper/cli/commands/chat.py - Token acquisition
src/perplexity_webui_scraper/cli/commands/get_session_token.py - MCP server
src/perplexity_webui_scraper/mcp/server.py - MCP tools
src/perplexity_webui_scraper/mcp/tools/ask.py
Shared types and errors
- Client settings
src/perplexity_webui_scraper/config/client.py - Conversation settings
src/perplexity_webui_scraper/config/conversation.py - Typed errors
src/perplexity_webui_scraper/_internal/exceptions.py
Other components
- Library user
- Perplexity WebUI
Connections 32
- Library user → Client: creates client
README.md - Client → Conversation: creates conversation
src/perplexity_webui_scraper/core/client.py - Client → HTTP transport: constructs transport
src/perplexity_webui_scraper/core/client.py - Client → Account access: reads account
src/perplexity_webui_scraper/core/client.py - Conversation → Account access: checks access
src/perplexity_webui_scraper/core/conversation.py - Conversation → File uploads: uploads attachments
src/perplexity_webui_scraper/core/conversation.py - Conversation → Request payload: builds request
src/perplexity_webui_scraper/core/conversation.py - Conversation → HTTP transport: sends requests
src/perplexity_webui_scraper/core/conversation.py - Conversation → Model registry: resolves model
src/perplexity_webui_scraper/core/conversation.py - Conversation → Stream parser: parses stream
src/perplexity_webui_scraper/core/conversation.py - Stream parser → Response data: produces snapshots
src/perplexity_webui_scraper/core/parser.py - HTTP transport → Perplexity WebUI: calls endpoints
README.md - HTTP transport → Browser fingerprint: uses fingerprint
src/perplexity_webui_scraper/http/client.py - HTTP transport → Retry and limits: retries requests
src/perplexity_webui_scraper/http/client.py - Model registry → Model metadata: loads models
src/perplexity_webui_scraper/models/registry.py - Client → Client settings: accepts settings
src/perplexity_webui_scraper/core/client.py - Client → Conversation settings: accepts settings
src/perplexity_webui_scraper/core/client.py - Library user → Interactive chat: asks questions
README.md - Interactive chat → Client: uses library
src/perplexity_webui_scraper/cli/commands/chat.py - Library user → Token acquisition: requests token
README.md - Library user → REST application: sends API request
README.md - REST application → Chat completions: routes completions
src/perplexity_webui_scraper/api/app.py - REST application → Model listing: routes model listing
src/perplexity_webui_scraper/api/app.py - Chat completions → Bearer authentication: authenticates request
src/perplexity_webui_scraper/api/routes/completions.py - Chat completions → Request mapping: maps request
src/perplexity_webui_scraper/api/routes/completions.py - Chat completions → Thread cache: reuses thread
src/perplexity_webui_scraper/api/routes/completions.py - Chat completions → Client: creates conversation
src/perplexity_webui_scraper/api/routes/completions.py - Model listing → Model registry: lists models
src/perplexity_webui_scraper/api/routes/models.py - Library user → MCP server: connects agent
README.md - MCP server → MCP tools: registers tools
src/perplexity_webui_scraper/mcp/server.py - MCP tools → Client: asks Perplexity
src/perplexity_webui_scraper/mcp/tools/ask.py - HTTP transport → Typed errors: raises typed errors
src/perplexity_webui_scraper/http/client.py