Post an random pet from shelters Zollstock and Dellbrück on Twitter @CutePetsCologne
Originated as a project of Team Denver during the 2014 fellowship at Code for America. Originally specific to Denver, it's been redeployed by a few cities. Check out this twitter list to see where. CutePetsCologne is mainly based on CutePetsChemnitz
Links to Bot
e.g. on a server running Ubuntu
Using root user
- Install io.js
- Install npm
sudo apt-get install npm
sudo apt-get install ruby ruby-dev rake
sudo gem install bundler
- Clone the repo to some $path
cd $path
git clone https://github.com/karen-sch/CutePetsCologne.git
cd CutePetsCologne
The API is available via http://127.0.0.1:3000/
cd API
npm install
npm run build
node lib/scraper.js
sudo ln -s /$path/CutePetsCologne/API/petscologne /etc/init.d
sudo update-rc.d petscologne defaults
sudo mkdir /var/cache/petscologne
sudo service petscologne start
- Create a new twitter app.
- On the API key tab for the Twitter app, modify permissions so the app can Read and Write.
- Create an access token. On the API Key tab in Twitter for the app, click Create my access token
- Take note of the values for environment set up below. Note: It's important to change permissions to Read/Write before generating the access token. The access token is keyed for the specific access level and will not be updated when changing permissions.
- Create a local .env file:
cp template.env .env
- Fill in the twitter keys created above.
bundler install
rake
Adding a cronjob:
5 9-22/2 * * * root cd /$path/CutePetsCologne && rake
-
Kudos to Darius for his great guide on how to make a twitter bot.
-
And kudo to Erik for the twitter gem.