/twote

Trying out Selenium to make a bot that posts a random Quote to Twitter if my Internet Speed is too slow.

Primary LanguagePython


Twote the Twitter bot

Trying out Selenium to make a bot that posts a random quotation to Twitter if my internet speed is too slow.

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Contributing
  5. Contact

About The Project

Woke up yesterday feeling like hmmm I just HAVE to try Selenium, so here's something I made with it.

Here's what it does:

  • Check your if your internet speed is good enough
  • If it's too slow, it gets a random quotation from zenquotes
  • It logs into the twitter account you saved in the .env file
  • It Tweets the quotation and the quotee's name.

Note: The bot was supposed to Tweet a complaint but I replaced it with random quotations because I like them better.

(back to top)

Built With

Python Selenium Twitter

(back to top)

Getting Started

To get a local copy up and running follow these simple example steps.

Prerequisites

Click on the links to download and install prerequisites, and copy the code snippets into a terminal to check if installed.

  • python
    python --version
  • selenium
    pip install selenium
  • drivers for your browser (I used Firefox)
Chrome: https://chromedriver.chromium.org/downloads
Edge: https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/
Firefox: https://github.com/mozilla/geckodriver/releases
Safari: https://webkit.org/blog/6900/webdriver-support-in-safari-10/

Installation

Follow these steps now:

  1. Create your Twitter account at https://twitter.com/
  2. Clone the repo
    git clone https://github.com/eshabaweja/twote
  3. Create a .env file inside the repo
    touch .env
  4. Save the following in .env
     TWITTER_USERNAME = 'your_twitter_username'
     TWITTER_PASSWORD = 'your_twitter_password'
  5. (Optionally) change the speeds to your need in main.py:
PROMISED_UP = your_up_speed
PROMISED_DOWN = your_down_speed

(back to top)

Usage

I created this project as a learning experience for myself. The twitter API is obviously an easier alternative to post tweets. However, you may modify this project to scrape the data of your choice and tweet accordingly.

(back to top)

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

Contact

Esha Baweja - @eshcapist

Twote: https://github.com/eshabaweja/twote

(back to top)