fix: install XHR interceptor after navigation to prevent context reset#91
Merged
jackwener merged 1 commit intojackwener:mainfrom Mar 19, 2026
Merged
Conversation
goto() triggers a full page navigation that resets the JS execution context, wiping any previously injected fetch/XHR monkey-patches. The old code installed the interceptor on x.com then navigated away, so the interceptor was always destroyed before it could capture data. Fix: navigate directly to the target page, install interceptor after page load, then scroll to trigger API calls via pagination. Also fixes the same bug in notifications.ts. Closes jackwener#86
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.
Summary
twitter searchalways returning empty results (twitter search returns empty results (INTERCEPT strategy not catching SearchTimeline) #86, [Bug]: opencli twitter search --query "马斯克" 返回 (no data) #79)twitter notificationssame root cause ([Bug]: opencli twitter notifications #87)goto()triggers a full page navigation that resets the JS execution context, wiping the previously injected fetch/XHR monkey-patchesCloses #79
Closes #86
Closes #87
Test plan
opencli twitter search "test" --limit 5returns resultsopencli twitter notifications --limit 5returns results