Skip to content

Instantly share code, notes, and snippets.

@osnr
Created February 9, 2021 03:40
Show Gist options
  • Save osnr/af1b11fce05df694c7d919c833661beb to your computer and use it in GitHub Desktop.
Save osnr/af1b11fce05df694c7d919c833661beb to your computer and use it in GitHub Desktop.
Search your tweets around the time you took a screenshot.

If you have a Screenotate screenshot HTML file open in your browser, clicking this bookmarklet will search your old tweets from around the time you took the screenshot, so you can find your original tweet of it (if it exists).

Make a new bookmark with the below as URL, replacing from:rsnous with from:YourTwitterUsername:

javascript:void%20function(){const%20a=new%20Date(document.body.innerHTML.match(/%3Cdd%3E(\d\d\d\d\-\d\d\-\d\d)/)[1]),b=new%20Date(a.getTime());b.setDate(b.getDate()-1);const%20c=new%20Date(a.getTime());c.setDate(c.getDate()+1);const%20d=`from:rsnous%20since:${b.toISOString().slice(0,10)}%20until:${c.toISOString().slice(0,10)}`;window.location.href=`https://twitter.com/search%3Fq=${encodeURIComponent(d)}`}();

Or construct the bookmarklet URL yourself -- here's the source code:

const date = new Date(document.body.innerHTML.match(/<dd>(\d\d\d\d\-\d\d\-\d\d)/)[1]);
const since = new Date(date.getTime()); since.setDate(since.getDate() - 1);
const until = new Date(date.getTime()); until.setDate(until.getDate() + 1);
const q = `from:rsnous since:${since.toISOString().slice(0, 10)} until:${until.toISOString().slice(0, 10)}`;
window.location.href = `https://twitter.com/search?q=${encodeURIComponent(q)}`;

You can paste this (after changing from:rsnous) into, e.g., https://chriszarate.github.io/bookmarkleter/ to get a bookmarklet link that you can drag straight to your bookmarks bar.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment