Charlton's Blog

Publicly Host Your Own Twitter Archive

A how-to, since I'm leaving and all.

Published: Dec 18, 2022
Category: Blog, Projects
Tags: , ,

The time has finally come: With the advent of Twitter’s new “Promotion of Alternative Social Platforms Policy”, I have utterly lost my confidence in the governance of the platform.

If you’re like me, Twitter filled a niche. Part notebook, part blog, I have tweets tied to memorable events and would like to preserve their sentimental value somewhere on the open Internet (ideally somewhere outside of Twitter).

Luckily, it’s easy to download an archive of your tweets, which are neatly delivered in a .zip file and browseable as a normal web page. Does that mean we can just upload them to a web server? Almost! But there are some steps to take for redacting personal information before publication.

Your Twitter archive contains your tweets, likes, followed accounts/followers, but also some sensitive personal information:

  • Your phone number,
  • Your email address,
  • Your birthday,
  • Direct messages,
  • Your advertising interests/demographics, and every add you’ve interacted with,
  • Information about devices you use with Twitter,
  • And much more

It also includes other information you may not want to make public, such as:

  • Deleted tweets,
  • Blocked/muted accounts,
  • IP addresses you’ve used Twitter from,
  • Connected third-party services

Scrubbing Your Archive

Scrubbing your archive can be done in two steps: First by deleting (or .gitignore-ing) the following files in /data:

device-token*
direct-message*
email-address*
mute.js
ni-devices.js
phone-number.js
block.js
account-creation-ip.js
ad-*
ageinfo.js
device-token.js
deleted-tweet*
ip-audit.js
contact.js
user-link-clicks.js
personalization.js
connected-application.js

And secondly, by scrubbing your contact information (birthday, email, and phone number) from what remains:

export LC_ALL=C 
find ./data -type f -exec sed -i '' -e 's/YYYY-MM-DD//g' {} \;
find ./data -type f -exec sed -i '' -e 's/[email protected]//g' {} \;
find ./data -type f -exec sed -i '' -e 's/8001234567//g' {} \;

Live Example

You can view a live example (and memorial to my Twitter account) at the following link: https://twitter-archive.ctis.me.

If you want to see future updates, you can find me at @[email protected].

Bonus

If you’re an IFTTT user, you can easily write applets to post on your mastodon account. This article lays the details out in a straightforward way.