Skip to content

Instantly share code, notes, and snippets.

@knoajp
Last active July 10, 2020 06:54
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save knoajp/160082bde4402a4a7db684627bc5ef5d to your computer and use it in GitHub Desktop.
Save knoajp/160082bde4402a4a7db684627bc5ef5d to your computer and use it in GitHub Desktop.
Twitter Before/After
(function(){
let name = location.href.match(/twitter\.com\/([^/]+)\//)[1];
let match = document.querySelector('a[href$="#source-labels"]').parentNode.firstElementChild.textContent.match(/([0-9]+)年([0-9]+)月([0-9]+)日/);
let date = new Date(`${match[1]}-${match[2]}-${match[3]}`) - 0, since = new Date(date - 1000*60*60*24).toISOString().substr(0,10), until = new Date(date + 1000*60*60*24).toISOString().substr(0,10);
location.assign(`https://twitter.com/search?q=from%3A${name}%20since%3A${since}%20until%3A${until}&f=live`);
})();
@knoajp
Copy link
Author

knoajp commented Jul 9, 2020

It's for Japanese locale only, but you can customize the regexp and so on.
https://twitter.com/kantankikaku/status/1277445534207209472
Twitter should implement ISO/Unix time in the individual tweet view.
https://twitter.com/kantankikaku/status/1277434626043084800

日本語でしか動きませんが、正規表現などのカスタマイズは可能です。
https://twitter.com/kantankikaku/status/1277445534207209472
Twitterは個別ツイート画面にISO/Unix時刻を埋め込むべき。
https://twitter.com/kantankikaku/status/1277434626043084800

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