canonize is a tool to help review your tweets, turn them into Writing, and host them on a Jekyll site.
You need Python 3.something and Ruby of some kind.
install:
sudo apt-get install ruby-full build-essential zlib1g-dev
gem install bundler
bundle init
bundle install
pip install -r requirements.txt
There's a decent chance that bundler or jekyll setup will stomp on existing files. If it does, revert their changes.
for local preview:
bundle exec jekyll serve
If you prefer a devcontainer or GitHub codespaces, that works too. For some reason the pip install -r requirements.txt
command doesn't work but you can just run it yourself.
drafts/
and canon/
folders tweets.js
and deleted-tweets.js
into a subdirectory of this repo called input/
scratch/
auth_token
and ct0
values from a Cookie:
headersecrets.py
with the following contents, and fill them in:cookies = {
"auth_token": "XXXX",
"ct0": "XXXX"
}
These seem to last a long time (weeks?).
python tweetpile.py
.This will walk all your tweets and query Twitter for other people's tweets in the conversation.
This takes a while (hours) because Twitter has a ratelimit of 150 requests every 15 minutes.
You can safely Ctrl+C out of the process and it'll pick up where it left off next time you run.
python twinder.py
.twinder is "tinder for your tweets". Each Twitter thread you've contributed to will be shown to you, and you'll be prompted to keep it or skip it. If you keep it, it'll ask you for an article name and some tags, and will output a markdown file with the thread and some metadata into the drafts/
directory.
canonize is only interested in your tweets, so if other people have posted in the thread after your last tweet, they might not show up in the reviewer. However, twinder prints each tweet's status ID, which you can copy to your browser and stick at the end of twitter.com/any_username/status/<the_id>
to look it up.
You can safely Ctrl+C out of the process and it'll pick up where it left off next time you run.
You now have a drafts/
folder full of Twitter threads. What you want to do with them is up to you!
My process is something like:
sources
and mentions
lists at the top of the markdown file (if you're hosting the articles on the Jekyll site).drafts/
to canon/
.canonize is designed as a Jekyll site that can be hosted on GitHub Pages.
_config.yml
as per normal Jekyll; you should change the values there from mine to yours.index.md
is the homepage._pages/about.md
._layouts/default.html
, if you want to edit that.Place articles in either drafts/
or canon/
. Articles in drafts/
will only show up in the explorer if you check the "show drafts" box, and will have a 📝 icon next to them.
The explorer finds these files by checking an index that is generated by running python gen_contents.py
. This will create a contents.json
file that you should check in along with your article commits.
If you ever re-download your archive, you can update the tweet .js files in input/
and rerun tweetpile.py
. It should Just Work, integrating new tweets into their respective conversations. If you have replied to a thread since last time you reviewed it, that thread should show up for review next time you run twinder.py
. But I haven't tested any of this.
contents.json
too