Enhance extraction feature and improve login flow#7
Open
corovcam wants to merge 2 commits into
Open
Conversation
The upstream stopped working sometime after July 2025 because Perplexity changed several DOM selectors, the login flow, and the per-thread API pagination defaults. Changes: - login.ts: multi-selector cookie banner (EN + CS variants); verify login via /api/auth/session poll instead of waiting for #ask-input (which is rendered to logged-out users too); explicit instructions to use the 6-digit code and not the magic link in the email (the magic link logs in the user's regular browser, not the Puppeteer-controlled one). - listConversations.ts: replaced data-testid based DOM scrape (which only saw the ~20 sidebar threads) with observe-and-replay of the /rest/thread/list_ask_threads POST. Walks offset to enumerate the full archive. - ConversationSaver.ts: replaced response-listener based capture with a direct API call to /rest/thread/<uuid>?limit=1000. Paginates via has_next_page + offset. The original captured the SPA's natural request which used limit=10, silently truncating any thread with >10 turns. ~10x faster (no per-thread page navigation) and avoids detached-frame errors. - exportLibrary.ts: try/catch per conversation with page-recreation recovery on detached-Frame / Target-closed / Session-closed errors. Cookies persist on the browser context so no re-login during recovery. Render errors are caught per-thread (JSON saved even if MD rendering fails). - README: fork notice up top describing what changed.
- Added command to extract JSON and Markdown pairs by collection title. - Implemented `extractByCollectionTitle` function for file handling. - Updated CLI to support extraction command. - Improved login process to handle session checks more robustly. - Added support for additional cookie banner acceptance options.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
extractcommand to extract JSON and Markdown pairs by collection title.extractByCollectionTitlefunction for handling extraction logic.Credits: #6 for fixing bugs