I wanted to see what I was Tweeting on this exact day last year. And all the years before. So I built a website! It’s a disgusting hack, and I’m truly sorry for unleashing it on you.
Using the API
The Twitter search API only goes back 7 days. This whole idea would be much easier if I had access to the Premium API.
But! The Twitter website has no such restrictions.
Twitter’s Advanced Search allows you to pick specific dates to search for. Here’s the string which shows my username’s Tweets on Christmas day 2015:
search?q=from:edent (until:2015-12-26 since:2015-12-25)
So how do we embed Twitter’s site on our page?
Twitter’s X-Frame-Options Policy doesn’t allow embedding. Oh well. Guess we have to give up.
Busting makes me feel good
Using the X-Frame Bypass Web Component is a real-life cheat-code.
X-Frame-Bypass is a Web Component, specifically a Customized Built-in Element, which extends an IFrame to bypass the
X-Frame-Options: deny/sameoriginresponse header. Normally such headers prevent embedding a web page in an
<iframe>element, but X-Frame-Bypass is using a CORS proxy to allow this.
It’s dead simple to use. Stick this in your
<script type="module" src="https://unpkg.com/x-frame-bypass"></script>
Stick it all together.
I wrote some horrible code to shove a dozen iFrames on a page.
The frames each point to the mobile version of the Twitter site – that provides a single column layout. The X-Frame Bypass doesn’t send a User Agent Header – which is lucky because it forces Twitter to serve up a legacy version of the site.
It only loads 20 Tweets per day – so you’ll need to click through if you were particularly loquacious that day.
I can’t be bothered to release this as a proper site. But if you want to – go ahead!