Transforms tweets in ReST (for pelican static site generator). Handles URL, mentions and pictures. Records only "real tweet" (no direct mentions, no retweets).
- Python
- jpcw for telling me Python
- Twitter API
- Python's modules :
- urlextract
- Beautiful Soup
- core modules :
json
,datetime
,dateutil
,locale
,PIL
,io
,urllib.request
,os
,argparse
,logging
andurllib.request
- Pelican static site generator
- Install
python3
- Install third-party required modules (see
requirements.txt
) This explains how to do - Create a twitter app https://apps.twitter.com/ and create an access token (copy all credentials somewhere safe)
- copy the script
tweets2rst.py
in your "pelican" directory python3 tweets2rst.py token token_key con_secret con_secret_key twitter_name
- Optionnaly, you can use
-D
to see some (not really useful) debug message - Optionnaly, create some cron or systemd-timers task to populate your blog content every 15 minutes (see API rate limits). I encourage to do this because there is a limit how deep in twitter where API can dive and retrieve tweets (i.e. : you can loose some tweets).
This work is free. You can redistribute it and/or modify it under the terms of the Do What The Fuck You Want To Public License, Version 2, as published by Sam Hocevar. See the COPYING file for more details.