All Projects β†’ jpescada β†’ TwitterPiBot

jpescada / TwitterPiBot

Licence: MIT License
A Python based bot for Raspberry Pi that grabs tweets with a specific hashtag and reads them out loud.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to TwitterPiBot

discord-twitter-webhooks
πŸ€– Stream tweets to Discord
Stars: ✭ 47 (-44.71%)
Mutual labels:  tweets, twitter-api, tweepy
Tweetie
Simple jQuery Twitter feed plugin
Stars: ✭ 314 (+269.41%)
Mutual labels:  twitter, tweets, twitter-api
archive-explorer-web
Browse your Twitter archive with a friendly, responsive, full experience, and quickly delete the tweets you don't want.
Stars: ✭ 19 (-77.65%)
Mutual labels:  twitter, tweets, twitter-api
Linqtotwitter
LINQ Provider for the Twitter API (C# Twitter Library)
Stars: ✭ 401 (+371.76%)
Mutual labels:  twitter, tweets, twitter-api
Twitter To Sqlite
Save data from Twitter to a SQLite database
Stars: ✭ 203 (+138.82%)
Mutual labels:  twitter, twitter-api, sqlite
TwitterAutoReplyBot
This is a tiny Python script that replies to a specified number of tweets containing a specified hashtag.
Stars: ✭ 33 (-61.18%)
Mutual labels:  tweets, twitter-api, tweepy
Twitter Scraper
Scrape the Twitter Frontend API without authentication.
Stars: ✭ 3,037 (+3472.94%)
Mutual labels:  twitter, tweets, twitter-api
Twitter
Twitter API for Laravel 5.5+, 6.x, 7.x & 8.x
Stars: ✭ 755 (+788.24%)
Mutual labels:  twitter, tweets, twitter-api
Twitter Post Fetcher
Fetch your twitter posts without using the new Twitter 1.1 API. Pure JavaScript! By Jason Mayes
Stars: ✭ 886 (+942.35%)
Mutual labels:  twitter, tweets, twitter-api
Twitterdelete
πŸ’€ Delete your old, unpopular tweets.
Stars: ✭ 231 (+171.76%)
Mutual labels:  twitter, tweets, twitter-api
Archive-Tweets
Archive and Delete Liked and Posted Tweets
Stars: ✭ 28 (-67.06%)
Mutual labels:  twitter, tweets, twitter-api
tweet-delete
Self-destructing Tweets so you too can be cool 😎
Stars: ✭ 68 (-20%)
Mutual labels:  tweets, twitter-api
SMMT
Social Media Mining Toolkit (SMMT) main repository
Stars: ✭ 116 (+36.47%)
Mutual labels:  tweets, twitter-api
TinyFlowerBeds
Educational bot that posts a tiny flower bed on Twitter every few hours. Check it out if you're new to Python and open source!
Stars: ✭ 12 (-85.88%)
Mutual labels:  twitter-api, tweepy
nitter scraper
Scrape Twitter API without authentication using Nitter.
Stars: ✭ 31 (-63.53%)
Mutual labels:  tweets, twitter-api
trumptweets
Download data on all of Donald Trump's (@RealDonaldTrump) tweets
Stars: ✭ 39 (-54.12%)
Mutual labels:  tweets, twitter-api
TgTwitterStreamer
Continous Integration from Twitter to Telegram.
Stars: ✭ 55 (-35.29%)
Mutual labels:  tweets, tweepy
congresstweets
Datasets of the daily Twitter output of Congress.
Stars: ✭ 76 (-10.59%)
Mutual labels:  twitter, tweets
gnip
Connect to Gnip streaming API and manage rules
Stars: ✭ 28 (-67.06%)
Mutual labels:  twitter, tweets
kafka-twitter-spark-streaming
Counting Tweets Per User in Real-Time
Stars: ✭ 38 (-55.29%)
Mutual labels:  twitter-api, tweepy

TwitterPiBot

A Python based bot for Raspberry Pi that grabs tweets with a specific hashtag and reads them out loud.

It was a quick side project that served as a good learning exercise for me. As this was a side project, I've set a limit of 2 days to get it done. Yes, it is sort of hacked together and could use a bit of refactoring. But it still handled the top trending hashtag #StarWars for 24 hours, without breaking. So, it's stable (enough) and working fine. (famous last words?)

How does it work?

This python app connects to Twitter Streaming API and captures tweets with a specific hashtag. Those captured tweets are then processed and stored in a local SQLite database that works like a queue. And lastly (every few seconds), a tweet is picked from that queue and ran through a text-to-speech engine converting the tweet into audio, that is played out through speakers connected to the audio jack.

What’s inside?

To run, it uses a good chunk of 3rd party modules, such as:

  • Peewee (to manage models and an SQLite database)
  • Tweepy (to access Twitter API)
  • Flite (to synthetise speech from tweets)

What do you need to make it work?

Essentially, a Raspberry Pi (running Debian) with a USB Wifi dongle attached (and connected to the internet). Then you need some source of power (such as a USB portable battery pack) and one or two speakers connected to the 3.5mm audio jack.

How do you get this up and running?

To run the instructions below, you have two options (that I can remember):

  1. plug your Raspberry Pi to a screen, mouse, keyboard and run in the terminal
  2. connect to your Raspberry via SSH from your computer and run it remotely (which is waaay cooler!)

I recommend the second option. And if you go with the second option, I also recommend using screen in SSH to allow resuming your session without having to leave an SSH window open. To install screen run the following in terminal:

$ sudo apt-get install screen

1. Create a Twitter app

Ok, so first things first: you need to create a Twitter app to use their API. Go to https://apps.twitter.com and create a new app. Once that is done, under the "Keys and Access Tokens" tab also generate an Access Token.

2. Update and install packages

Now, let's make sure your Raspberry Pi is up-to-date. In terminal run the following two commands:

$ sudo apt-get update

$ sudo apt-get upgrade

And one (more) package to install: Flite, the text-to-speech engine that we'll be using. Run this:

$ sudo apt-get install flite

3. Install app in your Raspberry Pi

Start by cloning this repository to your Raspberry Pi:

$ git clone https://github.com/jpescada/TwitterPiBot.git

Go into that new folder:

$ cd TwitterPiBot/

Make sure pip is up to date:

$ sudo pip install -U pip

And install the python modules required for this app (Peewee and Tweepy):

$ sudo pip install -r requirements.txt

4. Update the app config

Just one last thing to do before running it for the first time. Open the config.py file in the root folder to update the Twitter API credentials and the hashtag to search for:

$ sudo nano config.py

When you're done, hit Ctrl+X to close and save the file.

5. Finally, run the app

Just type the command:

$ python main.py

If everything went according to plan, it should connect to Twitter start collecting tweets and reading them out loud every 30 seconds.

To exit, hit Ctrl+C.

How to adjust the volume?

In terminal, run the command:

$ alsamixer

Then use keyboard up and down keys for volume, m key to mute and esc key to exit.

Bugs?

What bugs? :) If you found any issues, please report it in the Issues or, if you can fix it, submit a Pull request. Thank you!

Credits

The original idea behind this project came from a client request (who later dropped it), but it's based on Hugo the Twitter-Powered Robot by Paper Leaf.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].