This program is a Twitter poster. This will retrieve all information from a rss feed that you configure and then will post at your twitter timeline as long time you set.
In the code have 2 big processes:
-
The process that retrieve and store in a simple SQLite3 database the data from rss feed
-
The process that read from database a random data and post it in the Twitter
This two processes run as threads in the system, so we can determine different times do be the actions, precisely becouse read the feed of the site and post the links on the twitter not be performed at the same time.
This program need to be configured in the "config.py"
file. This is the
options:
FEED_URL | The feed URL |
DBFILE | The name of the database file |
TABLENAME | The name of the table in the database |
BEGIN_TWITTER_TEXT | A text that will be posted at BEGIN of twitt |
FIXED_TWITTER_TEXT | A text that will be posted at END of twitt |
PAUSE_TIME_FEED_READER | Time of the database updater will run, in seconds |
PAUSE_TIME_TWITTER | Time of the twitter posts will be posted, in seconds |
TAG_MAX_LENGTH | Max size of tag term to post it, tags given from RSS |
TAGS_QTD | Max number of tags to post in twitt |
MIN_POST_REPETITION | Minimal number of posts to permit repeat posts |
Twitter app configuration (http://apps.twitter.com) | |
t_token | Access token |
t_token_key | Access Token Secret |
t_con_secret | Consumer Key |
t_con_secret_key | Consumer Secret |
- Read rss for more than 1 site
- Post to other social networks
Libs:
- feedparser - https://feedparser.readthedocs.org
- dataset - https://dataset.readthedocs.org
- twitter - https://pypi.python.org/pypi/twitter
- multiprocessing - https://pymotw.com/2/multiprocessing/
Python version: 3.4.3
You can run this script with only one of the partes running:
$ python poster.py [all|update|post]
This code is licensed under the GPLv3, like you can read in the license.txt
or in this url: http://www.gnu.org/licenses/gpl-3.0-standalone.html
Sérgio Berlotto Jr sergio.berlotto@gmail.com