Robb Lewis: Code

one40

A personal, searchable Twitter archive built with Laravel.

View a live demo

Requirements

Inital Setup

User account

Run php artisan one40:setup; this will prompt for an email and password. This user account is used to login to one40 to see fetch logs and limit access to your archive (if the app is set to private).

Importing your archive

NB: You can request your Twitter archive here

To import your archive, move all the (data/js/tweets/year_month.js) files to resources/archive (create the archive directory if it doesn’t exist) and run php artisan one40:import. This can take a while depending on the size of your archive, so if it times out, just rerun it — one40 keeps track of which files it has imported, so it won’t re-run the same archive file twice.

Fetching new tweets

You can fetch new tweets by running php artisan one40:fetch. This will import your most recent tweets (up to 3200) so it’s best to import a recent archive first. It’s recommended you setup a cron job to fetch new tweets on a schedule (although you can do it manually if you want). To fetch new tweets at midday every day, add this to your crontab:

1 12 * * * php /path/to/your/project/artisan one40:fetch

This article explains how to setup cron jobs.

Contributing

The primary purpose of this is for me to be able to quickly search my tweets. I am aware there are some weird bugs with imported tweets being truncated and displaying in strange ways (see all issues) — I don’t have the time to fix them but I will happily accept pull requests that fix these issues.

I’m also aware of how messy a lot of the code is — a lot of the importing code is copy/pasted from Tweetnest. Again, I’ll happily accept PRs that improve this.

If you have an idea for a new feature, open an issue describing the feature so we can discuss if it before you put significant work into it.

License

Signifcant portions of the tweet importing logic is from Tweetnest licensed under MIT.

http://rmlewisuk.mit-license.org/