Skip to content

denizsivas/twitter-bot-computational-fluids

 
 

Repository files navigation

Twitter bot that shares computational research

👉 @cfdspace

Hi 👋 I am a twitter bot and my goal is to share all computational research at one place.


Documentation

👉 https://acrlakshman.github.io/twitter-bot-computational-fluids/


What do I do?

I search twitter feed every few minutes for some hashtags focused on computational research and I retweet them for now.

Can you make me do something else?

Sure you can, just fork me, change some code logic or default hashtags that suits your needs and deploy it as detailed below. But, please put me only to good use.

Can you tune parameters without restarting me?

Yes you can. Connect to mongodb and change the values in the collection config. Some of the things you can do right now are:

  • Change number of tweets that I can search for each time I make API call
  • Pause me by setting pause_app: true. I won't talk to twitter 😄
  • Change hashtags for which I can scan twitter to find content

Want to know a little more on how I work?

  • I scan for some tweets with predefined hashtags
  • I store them in a database to do further processing. This avoids me to make too many API calls
  • I scan for some metadata and post tweets that meet predefined criteria and save both posted tweets and discarded tweets
  • Posted and discarded list are used to avoid spamming content. In future I will periodically clean these databases
  • Poll vs Stream: Currently I rely on polling
  • Context analysis: For now I can't handle this, but you can extend me to do that

What hashtags can I handle for now?

  • computationalfluiddynamics
  • openfoam

Ingredients used


How to start me?

Using docker-compose

Deploy

  • Clone and configure the scripts
git clone https://github.com/acrlakshman/twitter-bot-computational-fluids twitter-bot
cd twitter-bot
mkdir -p logs db
  • Enter API keys and ACCESS tokens in docker-compose.yml
  • Enter desired credentials for mongodb admin.
  • Start containers
docker-compose up -d

Stop

docker-compose down -v

Using docker stack

Deploy

Make sure to create swarm

docker swarm init
# or
docker swarm init --advertise-addr <MANAGER_NODE_IP>
git clone https://github.com/acrlakshman/twitter-bot-computational-fluids twitter-bot
cd twitter-bot
mkdir -p logs db
  • Enter API keys and ACCESS tokens in docker-stack.yml
  • Enter desired credentials for mongodb admin.
  • Start containers
docker stack deploy -c docker-stack.yml bot

Stop

docker stack rm cfdspace_stack

Database and logs

  • Database persists in the volume db
  • App logs are stored in logs/cfdspace.log

Docker images

Notes

  • This app uses a persistent database, which keeps growing and will consume disk space. For now you need to manually perform the cleanup and keep an eye on the space used by mongodb. I will update the code to automate such that app does this automatically while it is running.
  • Any changes made to the source code in app/ requires rebuilding docker image.

About

Twitter bot that shares computational research posts

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 97.4%
  • Dockerfile 2.1%
  • Shell 0.5%