- Go to a page other than Home (e.g. Notifications)
- Refresh the tab so you don't have any Home timeline Tweets cached
- Paste the code from
patch.jsinto the F12 developer Console - Your Following feed will now be sorted by "Popular" until you next refresh the tab
Last active
December 19, 2025 20:51
-
-
Save insin/baf3ff2965aaeb95509aeefda88c5a17 to your computer and use it in GitHub Desktop.
Preview "Popular" sort for the Following timeline in Twitter Web
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
| void function () { | |
| const XMLHttpRequest_open = XMLHttpRequest.prototype.open | |
| XMLHttpRequest.prototype.open = function(method, url) { | |
| if (url.includes('/HomeLatestTimeline')) { | |
| if (method.toUpperCase() == 'GET') { | |
| let request = new URL(url) | |
| let params = new URLSearchParams(request.search) | |
| let variables = JSON.parse(decodeURIComponent(params.get('variables'))) | |
| variables.enableRanking = true | |
| params.set('variables', JSON.stringify(variables)) | |
| url = `${request.origin}${request.pathname}?${params.toString()}` | |
| } else { | |
| this._method = method.toUpperCase() | |
| this._url = url | |
| } | |
| } | |
| return XMLHttpRequest_open.apply(this, [method, url]) | |
| } | |
| const XMLHttpRequest_send = XMLHttpRequest.prototype.send | |
| XMLHttpRequest.prototype.send = function(body) { | |
| if (body && this._method == 'POST' && this._url?.includes('/HomeLatestTimeline')) { | |
| try { | |
| let data = JSON.parse(body) | |
| if (data.variables != null && typeof data.variables == 'object') { | |
| data.variables.enableRanking = true | |
| body = JSON.stringify(data) | |
| } | |
| } catch (e) { | |
| // pass | |
| } | |
| } | |
| return XMLHttpRequest_send.apply(this, [body]) | |
| } | |
| }() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment