A bot application sharing scientific publications and educated opinions on psychedelic research, harm reduction and drug policy issues. A collaboration with: #mybrainmychoice
- Reads and parses a list of RSS feeds (i.e. PubMed) Tweets an article's title, link, abstract, and authors as a 5/5 thread 🧵.
- Retweets older RSS post after a given time.
- Retweets the most retweeted and up-voted post from:
- a global search for specified keywords or hashtags defined on
Settings.add_hashtag
. - a search result from a given distribution Twitter list defined on
Settings.mylist_id
.
- a global search for specified keywords or hashtags defined on
- Interacts with users by faving posts from the above.
- Schedule jobs for any of the above.
- Send automated debug reports via Telegram.
All functions can be used independently.
- Download or git clone Twitterbot:
git clone https://github.com/franasal/science_bot.git
- Run:
cd scibot
pip install . --user
- Create a Twitter application, and generate keys, tokens etc.
- Create a Telegram bot for post and debugging notifications.
- Modify the settings in the source code.
- Modify
feed_urls
list to add the RSS feeds of your choice. Here you can find a description on how to set an RSS search. - Modify the variables in the
example.env
file and add keys, tokens etc. for connecting to your Twitter app and save it as.env
in your home directory. - Modify
retweet_include_words
for keywords you want to search and retweet, andretweet_exclude_words
for keywords you would like to exclude from retweeting. For exampleretweet_include_words = ["foo"]
andretweet_exclude_words = ["bar"]
will include any tweet with the word "foo", as long as the word "bar" is absent. This list can also be left empty, i.e.retweet_exclude_words = []
. - Modify or add jobs to the
scheduled_job()
function.
- Modify
- Python 3+
- Twitter account
- Telegram account
Read the RSS feeds and post a thread to Twitter account:
$ scibot rss
Search globally for tweets and retweet them:
$ scibot rtg
Search for tweets within a Twitter list and retweet them:
$ scibot rtl
Retweet last own tweet:
$ scibot rto
Here you can learn how set-up tasks for the the scheduled_job()
function
There are some good free cloud solutions such as pythonanywhere, where you can deploy the bot, to do that just run:
$ scibot sch
🌺