Dennis Hackethal’s Blog

My blog about philosophy, coding, and anything else that interests me.

Published · 2-minute read

Why I Mirror My Tweets – and Why You Should, Too

I’ve decided to mirror my tweets. I’ve created lots of content for Twitter over the years – 8,588 tweets at the time of writing – and I want to have control over it.

If Twitter goes belly up, decides to delete my account, or something else goes wrong, those tweets will just be gone. But now I’ve downloaded all of my tweets, and I store my latest tweets in my own database once an hour. They are backed up with the rest of the database at regular intervals, too.

There are other advantages. People can now comment on all mirrored tweets, such as this one, without a Twitter account.

Coming from Twitter, finding a mirrored tweet of mine is easy because I use the same tweet ids. For example, in this URL – https://twitter.com/dchackethal/status/1596632004074012673 – replace twitter.com/dchackethal/status with blog.dennishackethal.com/tweets to get https://blog.dennishackethal.com/tweets/1596632004074012673.

To be sure, this openness also enables those I’ve blocked on Twitter to leave comments on mirrored tweets instead. But I have control over that, too, because I approve comments before they appear publicly. And my spam controls seem better than Twitter’s, at least in part, because my commenters need to solve a puzzle that is trivial for humans but still stumps machines. Twitter presents no such challenge.

Now people can even subscribe to my tweets without a Twitter account through an RSS feed. And another benefit is that I can format tweets using markdown. I often write tweets as if Twitter accepted markdown because many people know to understand the raw text appropriately (e.g. asterisks mean emphasis, a ‘>’ at the start of a line indicates a block quote, and so on). As a result, this mirrored tweet looks better than the original.

Other things I may do with mirrored tweets in the future that I can’t do on Twitter include:

  • Allowing people to filter tweets by language (I sometimes tweet in German and it’d be handy for most people to filter out those tweets)
  • More sophisticated search than Twitter currently offers through regular expressions (though I need to consider the security ramifications of this)
  • Extending my web of references to tweets

To that last point, you may have noticed that when posts, comments, or even podcast episodes link to each other, those links are extracted and listed both underneath the referencing and referenced entity. See, for example, the references listed underneath this post (not the footnotes; I mean the ‘References’ section underneath the footnotes). That way, people can find related content. Now I can do the same for tweets – if a tweet of mine links to a blog post of mine (say because I’m discussing something related on Twitter), I can now recognize and extract that reference from the mirrored tweet and show it underneath that blog post. People reading the blog post will be pointed to the tweet and can read the discussion. My Twitter and my blog become more integrated that way.

Mirrored tweets come with their own challenges. For example, I currently don’t group them by threads like Twitter does, which leaves some of them lacking in context. Nor do I display any media embedded in tweets (that’s partly to protect the privacy of my readers). But those are soluble problems and I may solve them in the future.

If you want to mirror your tweets as well, go to https://oauth-playground.glitch.me/ and choose the GET /2/tweets/:id endpoint. Run it with any tweet of yours, having added ‘author.id’ to the tweet.fields underneath, to get your user id from the returned payload. Then use it with the GET /2/users/:id/tweets endpoint. On the right, click on the three dots ‘…’ to expand the details of the request and get the underlying API endpoint. Poll that endpoint once every hour, say, with the limit set to 100 (that’s assuming you don’t tweet more than 100 times an hour).

To get older tweets, request a Twitter archive instead (here under “Download an archive of your data”) – the API won’t return more than (IIRC) 2000 tweets total, so any tweets older than that won’t be included. As part of the archive, you’ll get a bunch of files, one of which contains all your tweets. Then write a script to process that file and store the tweets in your db. (Unfortunately, tweets from the archive are formatted slightly differently from API ones, so you’ll need to change one or the other a bit to make things consistent.)

Mirrored tweets are currently in beta. They’re an experiment. Maybe they end up being a mistake and I’ll remove them. But for now I like the idea.


References

This post makes 1 reference to:


What people are saying

What are your thoughts?

You are responding to comment #. Clear

Preview

Markdown supported. cmd + enter to comment. Your comment will appear upon approval. You are responsible for what you write. Terms, privacy policy
This small puzzle helps protect the blog against automated spam.

Preview