Skip to content

Comments

fix: Fix response extraction logic to avoid always picking up welcome…#17

Open
qscde45 wants to merge 1 commit intoPleasePrompto:masterfrom
qscde45:fix-result-parse-issue
Open

fix: Fix response extraction logic to avoid always picking up welcome…#17
qscde45 wants to merge 1 commit intoPleasePrompto:masterfrom
qscde45:fix-result-parse-issue

Conversation

@qscde45
Copy link

@qscde45 qscde45 commented Feb 11, 2026

Title:
fix: Fix response extraction logic to avoid always picking up welcome message

Body:

Summary

  • Snapshot existing response texts BEFORE submitting a question, then only match new
    response elements after submission, preventing the welcome message or stale answers from
    being returned
  • Iterate over all response elements to find new content instead of always picking the
    last element

Problem

The previous logic took elements[-1] (the last response element), but in some cases the
last element was the welcome message or a stale answer, causing incorrect results to be
returned.

Solution

  1. Before submitting the question, record all existing response texts on the page
    (pre_texts)
  2. When polling after submission, only match elements whose text is NOT in pre_texts
  3. Prioritize the previously matched response_selector for more efficient lookups

… message

NotebookLM's welcome message always appears at the end of the response
element list, causing elements[-1] to return the welcome message instead
of the actual AI answer. Changed to snapshot existing texts before
submission, then find the truly new response by text comparison.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants