Generate a static HTML website from your twitter time line
Project description
What is it?
It’ a tool that makes sure your TL won’t be gone for ever if for some reason twitter decides to no longer play nice.
In a way, it also makes it possible to:
edit your tweets
have them longer than 140 characters
Show me!
Here’s an example of static_tl in action:
How to use it ?
Install Python3 and then install static_tl with pip
Create an app on http://apps.twitter.com
Edit ~/.config/static_tl.toml to have something like:
[auth] api_key = "<Consumer Key>" api_secret = "<Consumer Secret>" token = "<Acces Token>" token_secret = "<Acess Token Secret>" [[users]] [users.user_one] with_replies = false [users.user_two] with_replies = true
Then run:
static-tl get
This will generate some files with your recent tweets in a json folder.
For instance, if your run it on 2016 October 10, you’ll get two files:
json/<user>/2016-09.json (all the tweets from September)
json/<user>/2016-10.json (all the tweets from October so far)
Next time you’ll run static-tl get, we will look at the most recent status ID in the most recent .json file and only fetch new tweets. This means you can edit or even delete the tweets that are older than that :)
Then, when you are ready you can generate a completely static copy of your TL with:
static-tl gen
(By static, we mean that it’s possible to upload those html files wherever you want so it’s extremely easy to publish your new TL on the web)
Permalinks and feeds
If you want to generate permalinks, simply add site_url at the top of the .toml file:
site_url = http://example.com/tweets
By doing so, static-tl gen will also generate a <user>/feed.atom feed so that people can be notified about your new tweets via RSS instead of having to create an account on twitter :)
Tweaking the output
Customization can be done by simply editing the Jinja templates in static_tl/templates.
From the template you have access to all the fields returned by the official twitter API.
Also, any file not ending with .html in the templates folder will be copied directly to the html folder: useful for images, css files and the like.
Perform backup only
If you do not want to generate HTML files for a given user, use:
[[users]]
[users.<name>]
publish = false
Searching
Since version 0.4, static_tl gen also generates a tweets.sqlite file containing one table per user.
We use the FTS4 extension.
A search application is available in the sources : static_tl/search.py, using the flask framework.
This will only work if site_url is set, and if the flask server can be reached at <site_url>/search
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file static_tl-0.5.3.tar.gz
.
File metadata
- Download URL: static_tl-0.5.3.tar.gz
- Upload date:
- Size: 11.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d2ed31cb84b750db01eea801304ab1d2ad2443cbc69b9f05e6c4d63e1c16bd41 |
|
MD5 | e14b56922c4dcf14e637d462c58bcb8a |
|
BLAKE2b-256 | 8bf6f3719e44d77380b7f9fbeea88bab7e3c37633a734f6a075a31ff26f70995 |
File details
Details for the file static_tl-0.5.3-py3-none-any.whl
.
File metadata
- Download URL: static_tl-0.5.3-py3-none-any.whl
- Upload date:
- Size: 19.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e0698e342f562f6ea07a50960d841db7fa4159a263ae4f32fb1166a0f44bdebc |
|
MD5 | 738652f31445cd3d69c8a668c745b495 |
|
BLAKE2b-256 | 31120382779aa2368ff93447f7d4dd04cc21b06ac0893dc6a148dfc0c1a40e28 |