{"id":34752258,"url":"https://github.com/henrique-coder/perplexity-webui-scraper","last_synced_at":"2026-03-08T18:01:07.996Z","repository":{"id":294433195,"uuid":"958012285","full_name":"henrique-coder/perplexity-webui-scraper","owner":"henrique-coder","description":"Python scraper to extract AI responses from Perplexity's web interface.","archived":false,"fork":false,"pushed_at":"2026-02-09T19:47:22.000Z","size":1009,"stargazers_count":44,"open_issues_count":0,"forks_count":12,"subscribers_count":2,"default_branch":"prod","last_synced_at":"2026-02-09T23:12:58.698Z","etag":null,"topics":["ai","perplexity","scraper","webui"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/perplexity-webui-scraper","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/henrique-coder.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-03-31T13:55:33.000Z","updated_at":"2026-02-09T19:38:31.000Z","dependencies_parsed_at":"2025-05-20T12:41:09.148Z","dependency_job_id":"a3d13346-f43c-49c7-8c51-37a77e42c271","html_url":"https://github.com/henrique-coder/perplexity-webui-scraper","commit_stats":null,"previous_names":["henrique-coder/perplexity-webui-scraper"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/henrique-coder/perplexity-webui-scraper","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/henrique-coder%2Fperplexity-webui-scraper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/henrique-coder%2Fperplexity-webui-scraper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/henrique-coder%2Fperplexity-webui-scraper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/henrique-coder%2Fperplexity-webui-scraper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/henrique-coder","download_url":"https://codeload.github.com/henrique-coder/perplexity-webui-scraper/tar.gz/refs/heads/prod","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/henrique-coder%2Fperplexity-webui-scraper/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29802866,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-24T21:02:39.706Z","status":"ssl_error","status_checked_at":"2026-02-24T21:02:21.834Z","response_time":75,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","perplexity","scraper","webui"],"created_at":"2025-12-25T05:25:24.221Z","updated_at":"2026-03-08T18:01:07.985Z","avatar_url":"https://github.com/henrique-coder.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n# Perplexity WebUI Scraper\n\nPython scraper to extract AI responses from [Perplexity's](https://www.perplexity.ai) web interface.\n\n[![PyPI](https://img.shields.io/pypi/v/perplexity-webui-scraper?color=blue)](https://pypi.org/project/perplexity-webui-scraper)\n[![Python](https://img.shields.io/pypi/pyversions/perplexity-webui-scraper)](https://pypi.org/project/perplexity-webui-scraper)\n[![License](https://img.shields.io/github/license/henrique-coder/perplexity-webui-scraper?color=green)](./LICENSE)\n\n\u003c/div\u003e\n\n---\n\n## Installation\n\n### As a Library\n\n```bash\n# From PyPI (stable)\nuv add perplexity-webui-scraper\n\n# From GitHub prod branch (latest fixes)\nuv add git+https://github.com/henrique-coder/perplexity-webui-scraper.git@prod\n```\n\n### As MCP Server\n\nNo installation required - `uvx` handles everything automatically:\n\n```bash\n# From PyPI (stable)\nuvx --from perplexity-webui-scraper[mcp]@latest perplexity-webui-scraper-mcp\n\n# From GitHub prod branch (latest fixes)\nuvx --from \"perplexity-webui-scraper[mcp]@git+https://github.com/henrique-coder/perplexity-webui-scraper.git@prod\" perplexity-webui-scraper-mcp\n\n# From local directory (for development)\nuv --directory /path/to/perplexity-webui-scraper run perplexity-webui-scraper-mcp\n```\n\n## Requirements\n\n- **Perplexity Pro/Max account**\n- **Session token** (`__Secure-next-auth.session-token` cookie)\n\n### Getting Your Session Token\n\n#### Option 1: Automatic (CLI Tool)\n\n```bash\nuv run get-perplexity-session-token\n```\n\nThis interactive tool will:\n\n1. Ask for your Perplexity email\n2. Send a verification code to your email\n3. Accept either a 6-digit code or magic link\n4. Extract and display your session token\n5. Optionally save it to your `.env` file\n\n#### Option 2: Manual (Browser)\n\n1. Log in at [perplexity.ai](https://www.perplexity.ai)\n2. Open DevTools (`F12`) → Application/Storage → Cookies\n3. Copy the value of `__Secure-next-auth.session-token`\n4. Store in `.env`: `PERPLEXITY_SESSION_TOKEN=\"your_token\"`\n\n## Quick Start\n\n```python\nfrom perplexity_webui_scraper import Perplexity\n\nclient = Perplexity(session_token=\"YOUR_TOKEN\")\nconversation = client.create_conversation()\n\nconversation.ask(\"What is quantum computing?\")\nprint(conversation.answer)\n\n# Follow-up (context is preserved)\nconversation.ask(\"Explain it simpler\")\nprint(conversation.answer)\n```\n\n### Streaming\n\n```python\nfor chunk in conversation.ask(\"Explain AI\", stream=True):\n    print(chunk.answer)\n```\n\n### With Options\n\n```python\nfrom perplexity_webui_scraper import (\n    ConversationConfig,\n    Coordinates,\n    Models,\n    SourceFocus,\n)\n\nconfig = ConversationConfig(\n    model=Models.DEEP_RESEARCH,\n    source_focus=[SourceFocus.WEB, SourceFocus.ACADEMIC],\n    language=\"en-US\",\n    coordinates=Coordinates(latitude=12.3456, longitude=-98.7654),\n)\n\nconversation = client.create_conversation(config)\nconversation.ask(\"Latest AI research\", files=[\"paper.pdf\"])\n```\n\n## API Reference\n\n### `Perplexity(session_token, config?)`\n\n| Parameter       | Type           | Description        |\n| --------------- | -------------- | ------------------ |\n| `session_token` | `str`          | Browser cookie     |\n| `config`        | `ClientConfig` | Timeout, TLS, etc. |\n\n### `Conversation.ask(query, model?, files?, citation_mode?, stream?)`\n\n| Parameter       | Type                    | Default       | Description         |\n| --------------- | ----------------------- | ------------- | ------------------- |\n| `query`         | `str`                   | -             | Question (required) |\n| `model`         | `Model`                 | `Models.BEST` | AI model            |\n| `files`         | `list[str \\| PathLike]` | `None`        | File paths          |\n| `citation_mode` | `CitationMode`          | `CLEAN`       | Citation format     |\n| `stream`        | `bool`                  | `False`       | Enable streaming    |\n\n### Models\n\n| Model                              | Description                                                               | Tier |\n| ---------------------------------- | ------------------------------------------------------------------------- | ---- |\n| `Models.BEST`                      | Pro - Automatically selects the most responsive model based on the query  | pro  |\n| `Models.DEEP_RESEARCH`             | Deep research - Fast and thorough for routine research                    | pro  |\n| `Models.SONAR`                     | Sonar - Perplexity's latest model                                         | pro  |\n| `Models.GEMINI_3_FLASH`            | Gemini 3 Flash - Google's fast model                                      | pro  |\n| `Models.GEMINI_3_FLASH_THINKING`   | Gemini 3 Flash Thinking - Google's fast model                             | pro  |\n| `Models.GEMINI_31_PRO`             | Gemini 3.1 Pro - Google's latest model                                    | pro  |\n| `Models.GEMINI_31_PRO_THINKING`    | Gemini 3.1 Pro Thinking - Google's latest model with thinking             | pro  |\n| `Models.GPT_52`                    | GPT-5.2 - OpenAI's latest model                                           | pro  |\n| `Models.GPT_52_THINKING`           | GPT-5.2 Thinking - OpenAI's latest model with thinking                    | pro  |\n| `Models.CLAUDE_46_SONNET`          | Claude Sonnet 4.6 - Anthropic's fast model                                | pro  |\n| `Models.CLAUDE_46_SONNET_THINKING` | Claude Sonnet 4.6 Thinking - Anthropic's newest reasoning model           | pro  |\n| `Models.CLAUDE_46_OPUS`            | Claude Opus 4.6 - Anthropic's most advanced model                         | max  |\n| `Models.CLAUDE_46_OPUS_THINKING`   | Claude Opus 4.6 Thinking - Anthropic's Opus reasoning model with thinking | max  |\n| `Models.GROK_41`                   | Grok 4.1 - xAI's latest model                                             | pro  |\n| `Models.GROK_41_THINKING`          | Grok 4.1 Thinking - xAI's latest model                                    | pro  |\n| `Models.KIMI_K25_THINKING`         | Kimi K2.5 - Moonshot AI's latest model                                    | pro  |\n\n### CitationMode\n\n| Mode       | Output                |\n| ---------- | --------------------- |\n| `DEFAULT`  | `text[1]`             |\n| `MARKDOWN` | `text[1](url)`        |\n| `CLEAN`    | `text` (no citations) |\n\n### ConversationConfig\n\n| Parameter         | Default       | Description        |\n| ----------------- | ------------- | ------------------ |\n| `model`           | `Models.BEST` | Default model      |\n| `citation_mode`   | `CLEAN`       | Citation format    |\n| `save_to_library` | `False`       | Save to library    |\n| `search_focus`    | `WEB`         | Search type        |\n| `source_focus`    | `WEB`         | Source types       |\n| `time_range`      | `ALL`         | Time filter        |\n| `language`        | `\"en-US\"`     | Response language  |\n| `timezone`        | `None`        | Timezone           |\n| `coordinates`     | `None`        | Location (lat/lng) |\n\n## Exceptions\n\n| Exception                          | Description                                        |\n| ---------------------------------- | -------------------------------------------------- |\n| `PerplexityError`                  | Base exception for all library errors              |\n| `HTTPError`                        | HTTP error with status code and response body      |\n| `AuthenticationError`              | Session token is invalid or expired (HTTP 401/403) |\n| `RateLimitError`                   | Rate limit exceeded (HTTP 429)                     |\n| `FileUploadError`                  | File upload failed                                 |\n| `FileValidationError`              | File validation failed (size, type, etc.)          |\n| `ResearchClarifyingQuestionsError` | Research mode asking clarifying questions          |\n| `ResponseParsingError`             | API response could not be parsed                   |\n| `StreamingError`                   | Error during streaming response                    |\n\n## MCP Server (Model Context Protocol)\n\nThe library includes an MCP server for AI assistants like Claude Desktop and Antigravity.\n\nEach AI model is exposed as a separate tool - enable only the ones you need to reduce agent context size.\n\n### Configuration\n\nAdd to your MCP config file (no installation required):\n\n**Claude Desktop** (`~/.config/claude/claude_desktop_config.json`):\n\n```json\n{\n  \"mcpServers\": {\n    \"perplexity-webui-scraper\": {\n      \"command\": \"uvx\",\n      \"args\": [\n        \"--from\",\n        \"perplexity-webui-scraper[mcp]@latest\",\n        \"perplexity-webui-scraper-mcp\"\n      ],\n      \"env\": {\n        \"PERPLEXITY_SESSION_TOKEN\": \"your_token_here\"\n      }\n    }\n  }\n}\n```\n\n**From GitHub dev branch:**\n\n```json\n{\n  \"mcpServers\": {\n    \"perplexity-webui-scraper\": {\n      \"command\": \"uvx\",\n      \"args\": [\n        \"--from\",\n        \"perplexity-webui-scraper[mcp]@git+https://github.com/henrique-coder/perplexity-webui-scraper.git@prod\",\n        \"perplexity-webui-scraper-mcp\"\n      ],\n      \"env\": {\n        \"PERPLEXITY_SESSION_TOKEN\": \"your_token_here\"\n      }\n    }\n  }\n}\n```\n\n**From local directory (for development):**\n\n```json\n{\n  \"mcpServers\": {\n    \"perplexity-webui-scraper\": {\n      \"command\": \"uv\",\n      \"args\": [\n        \"--directory\",\n        \"/absolute/path/to/perplexity-webui-scraper\",\n        \"run\",\n        \"perplexity-webui-scraper-mcp\"\n      ],\n      \"env\": {\n        \"PERPLEXITY_SESSION_TOKEN\": \"your_token_here\"\n      }\n    }\n  }\n}\n```\n\n### Available Tools\n\nEach tool uses a specific AI model. Enable only the ones you need:\n\n| Tool                      | Model                      | Description                                                        | Tier |\n| ------------------------- | -------------------------- | ------------------------------------------------------------------ | ---- |\n| `pplx_ask`                | Pro                        | Automatically selects the most responsive model based on the query | pro  |\n| `pplx_deep_research`      | Deep research              | Fast and thorough for routine research                             | pro  |\n| `pplx_sonar`              | Sonar                      | Perplexity's latest model                                          | pro  |\n| `pplx_gemini_flash`       | Gemini 3 Flash             | Google's fast model                                                | pro  |\n| `pplx_gemini_flash_think` | Gemini 3 Flash Thinking    | Google's fast model                                                | pro  |\n| `pplx_gemini31_pro`       | Gemini 3.1 Pro             | Google's latest model                                              | pro  |\n| `pplx_gemini31_pro_think` | Gemini 3.1 Pro Thinking    | Google's latest model with thinking                                | pro  |\n| `pplx_gpt54`              | GPT-5.4                    | OpenAI's latest model                                              | pro  |\n| `pplx_gpt54_thinking`     | GPT-5.4 Thinking           | OpenAI's latest model with thinking                                | pro  |\n| `pplx_claude_s46`         | Claude Sonnet 4.6          | Anthropic's fast model                                             | pro  |\n| `pplx_claude_s46_think`   | Claude Sonnet 4.6 Thinking | Anthropic's newest reasoning model                                 | pro  |\n| `pplx_claude_o46`         | Claude Opus 4.6            | Anthropic's most advanced model                                    | max  |\n| `pplx_claude_o46_think`   | Claude Opus 4.6 Thinking   | Anthropic's Opus reasoning model with thinking                     | max  |\n| `pplx_grok41`             | Grok 4.1                   | xAI's latest model                                                 | pro  |\n| `pplx_grok41_think`       | Grok 4.1 Thinking          | xAI's latest model                                                 | pro  |\n| `pplx_kimi_k25_think`     | Kimi K2.5                  | Moonshot AI's latest model                                         | pro  |\n\n**All tools support `source_focus`:** `web`, `academic`, `social`, `finance`, `all`\n\n## Disclaimer\n\nThis is an **unofficial** library. It uses internal APIs that may change without notice. Use at your own risk.\n\nBy using this library, you agree to Perplexity AI's Terms of Service.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhenrique-coder%2Fperplexity-webui-scraper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhenrique-coder%2Fperplexity-webui-scraper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhenrique-coder%2Fperplexity-webui-scraper/lists"}