Skip to content

Commit a07b62f

Browse files
committed
adding lesson 6 and updating README
1 parent e9db82b commit a07b62f

File tree

4 files changed

+32
-2
lines changed

4 files changed

+32
-2
lines changed

6-streams/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
We’ll get a real-time stream of tweets, and learn how to filter a stream by keyword, location, and user.

6-streams/index.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
var Twit = require('twit');
2+
3+
var bot = new Twit({
4+
consumer_key: process.env.LEARNINGBOT_CONSUMER_KEY,
5+
consumer_secret: process.env.LEARNINGBOT_CONSUMER_SECRET,
6+
access_token: process.env.LEARNINGBOT_ACCESS_TOKEN,
7+
access_token_secret: process.env.LEARNINGBOT_ACCESS_TOKEN_SECRET,
8+
timeout_ms: 60*1000
9+
});
10+
11+
var stream = bot.stream('statuses/filter', {track: 'win, lose'});
12+
13+
stream.on('tweet', function(tweet){
14+
console.log(tweet.text+'\n');
15+
});

6-streams/package.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"name": "6-streams",
3+
"version": "1.0.0",
4+
"description": "",
5+
"main": "index.js",
6+
"scripts": {
7+
"test": "echo \"Error: no test specified\" && exit 1"
8+
},
9+
"author": "",
10+
"license": "ISC",
11+
"dependencies": {
12+
"twit": "^2.2.5"
13+
}
14+
}

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ In this course we’ll learn how to create Twitter bots. We’ll first learn how
1212

1313
4. Interacting with Tweets with Twit.js - We’ll learn the basics of interacting with tweets, including retweeting, deleting, and favoriting tweets.
1414

15-
5. Search Tweets with Twit.js - We’ll learn how to search all tweets with the Twitter Search API.
15+
5. Search Tweets with Twit.js - We’ll learn how to search tweets with the Twitter Search API.
1616

17-
6. Work with Tweet Streams with Twit.js - We’ll get a real-time stream of tweets, and learn how to filter a stream by keyword, location, and language.
17+
6. Work with Tweet Streams with Twit.js - We’ll get a real-time stream of tweets, and learn how to filter a stream by keyword, location, and user.
1818

1919
7. Tweeting Media Files with Twit.js - With this bot, we’ll learn how to tweet photos and audio, using media from NASA’s space archives.
2020

0 commit comments

Comments
 (0)