#Make-A-Twitter-Bot Workshop
Session led by Allison Parrish
##Some of my bots
- Power Vocab Tweet (markov chains)
- Library of Emoji (context-free grammars)
- Egress Methods (CMU pronouncing dictionary)
- Eventually Bot
| /* | |
| * A quick example of how to use Bluebird and Q to conjure your own promises | |
| * | |
| * Everything going on here is explained further in the following video: | |
| * http://youtu.be/OU7WuVGSuZw?list=PLT-DLWOBKbB4dZ83I_7Ca-sUTvorckG-E | |
| * | |
| */ | |
| // Import node modules | |
| var Q = require('q'); |
#Make-A-Twitter-Bot Workshop
Session led by Allison Parrish
##Some of my bots
| the best way (I've found) to completely uninstall node + npm is to do the following: | |
| go to /usr/local/lib and delete any node and node_modules | |
| go to /usr/local/include and delete any node and node_modules directory | |
| if you installed with brew install node, then run brew uninstall node in your terminal | |
| check your Home directory for any local or lib or include folders, and delete any node or node_modules from there | |
| go to /usr/local/bin and delete any node executable | |
| You may need to do the additional instructions as well: | |
| sudo rm /usr/local/bin/npm |
Learn how you can create your own Twitter bot using Node.js and the new Twitter API. The bot will auto retweet in response to tweets with some particular hashtags. (https://goo.gl/4whEIt)
Here are the tools we’ll be using to create the bot —
| var T = require("twit"); | |
| var Q = require("q"); | |
| // key and secret for Twitter for iPhone. | |
| // A whitelisted app is needed to access the cards API; you can't just create your own currently. | |
| var TWITTER_CONSUMER_KEY = "IQKbtAYlXLripLGPWd0HUA"; | |
| var TWITTER_CONSUMER_SECRET = "GgDYlkSvaPxGxC4X8liwpUoqKwwr3lCADbz8A7ADU"; | |
| // These you will have to fill in yourself by authorizing Twitter for iPhone for your account. | |
| // How to get the access tokens through OOB authorization is outside the scope of this snippet. | |
| var TWITTER_ACCESS_TOKEN = ""; |
| var Twit = require('twit') | |
| var moment = require('moment'); | |
| var fs = require('fs'); | |
| var T = new Twit({ | |
| consumer_key: '...', | |
| consumer_secret: '...', | |
| access_token: '...', | |
| access_token_secret: '...', | |
| timeout_ms: 60*1000, // optional HTTP request timeout to apply to all requests. |
The following guide will show you how to deploy a simple microservice written in JavaScript using 𝚫 now.
It uses Open Source tools that are widely available, tested and understood:
| var request = require('request'); | |
| var async = require('async'); | |
| // TODO: This could be in its own package. | |
| function postImage(opts, allDone) { | |
| var twit; | |
| var dryRun; | |
| var imgurl; | |
| var altText; | |
| var caption; |
| #!/usr/bin/env python | |
| """ | |
| If you use webrecorder.io to archive a Twitter search result and then download | |
| the WARC file you can use this script to read through the WARC file looking | |
| for tweet identifiers to hydrate. | |
| You'll need to install the [warc] module for the script to work. After that you should be able to: | |
| ./tweet-ids.py file.warc.gz > ids.txt |