fix: switch SearchTimeline from GET to POST to fix 404 errors#191
Merged
karashiiro merged 1 commit intothe-convocation:mainfrom Apr 1, 2026
Merged
Conversation
Twitter has started blocking GET requests to the SearchTimeline GraphQL endpoint, returning 404 for all search queries. This change switches the search endpoint to use POST with a JSON body instead of URL query parameters, matching the fix discovered in twikit#412. Changes: - api.ts: Add optional `body` parameter to requestApi(), set content-type header and stringify body for POST requests - api-data.ts: Add toRequestBody() method to ApiRequest class for converting variables/features/fieldToggles to JSON body - search.ts: Change getSearchTimeline from GET to POST, pass request body via toRequestBody() instead of URL via toRequestUrl() Fixes the-convocation#188
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 has started blocking GET requests to the
SearchTimelineGraphQL endpoint, returning 404 for all search queries. The Pythontwikitlibrary independently discovered the same fix in d60/twikit#412 on March 29, 2026.This PR switches the search endpoint from GET to POST with a JSON body, which resolves the 404 errors.
Changes
api.ts: Add optionalbodyparameter torequestApi(). When provided with a POST request, setscontent-type: application/jsonand stringifies the body.api-data.ts: AddtoRequestBody()method toApiRequestclass, convertingvariables/features/fieldTogglesto a JSON object (instead of URL query params).search.ts: ChangegetSearchTimelinefrom'GET'to'POST', passing the request body viatoRequestBody()instead of the URL viatoRequestUrl().Test plan
searchTweets()andfetchSearchTweets()now return results that previously gave 404getTweets) continues to work as beforeFixes #188