Skip to content

Instantly share code, notes, and snippets.

@mvark
Created September 11, 2024 05:02
Show Gist options
  • Save mvark/3bb2289a6305e561ef92a6e532ceff87 to your computer and use it in GitHub Desktop.
Save mvark/3bb2289a6305e561ef92a6e532ceff87 to your computer and use it in GitHub Desktop.
Bookmarklet to search a user's X timeline for a specified "term". Navigate to the user's profile page (x.com/user) and then click this bookmarklet. A pop-up window appears, asking for your search term. Returns the native X search results page, prepopulated with that term and limited to that user.
//bookmarklet by redditor @chickenandliver - https://www.reddit.com/r/bookmarklets/comments/1f7wk72/search_a_users_x_timeline_for_term/
javascript:(function(){
const term = prompt('Term?');
if (term) {
const username = new URL(location.href).pathname.split("/")[1];
window.location.href = `https://x.com/search?q=${encodeURIComponent(term)}%20(from%3A${encodeURIComponent(username)})&src=typed_query&f=live`;
}
})();
//Minified version -
//javascript:(function(){const term=prompt('Term?');if(term){const username=new URL(location.href).pathname.split("/")[1];window.location.href=`https://x.com/search?q=${encodeURIComponent(term)}%20(from%3A${encodeURIComponent(username)})&src=typed_query&f=live`;}})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment