44 | This is a client-side only application. 45 | It consumes a statuses/filter 46 | that is hosted by PubNub. 47 |
48 | 49 |To setup your own hosted Twitter stream see this gist. 50 | 51 |
-
53 |
- Waiting for Tweets . . . 54 |
├── .gitignore ├── LICENCE ├── README.md ├── config.sample.json ├── index.html ├── package.json ├── screenshot.png ├── stream-geo.js ├── stream-hashtags.js └── stream-sample.js /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | 5 | # Runtime data 6 | pids 7 | *.pid 8 | *.seed 9 | 10 | # Directory for instrumented libs generated by jscoverage/JSCover 11 | lib-cov 12 | 13 | # Coverage directory used by tools like istanbul 14 | coverage 15 | 16 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 17 | .grunt 18 | 19 | # Compiled binary addons (http://nodejs.org/api/addons.html) 20 | build/Release 21 | 22 | # Dependency directory 23 | # Deployed apps should consider commenting this line out: 24 | # see https://npmjs.org/doc/faq.html#Should-I-check-my-node_modules-folder-into-git 25 | node_modules 26 | 27 | # Config files 28 | config.json 29 | 30 | #DS_Store files 31 | .DS_Store 32 | 33 | .sass-cache 34 | 35 | npm-debug.log 36 | 37 | manifest.yml 38 | -------------------------------------------------------------------------------- /LICENCE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Twitter Inc. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | twitter-streaming-demos-node 2 | ========== 3 | 4 | Basic demos demonstrating Twitter streaming APIs. 5 | 6 | 7 | Installing and Running 8 | ---- 9 | 10 | Install [Node.js](http://nodejs.org/). 11 | 12 | Clone GitHub repo: 13 | 14 | ``` 15 | git clone https://github.com/twitterdev/twitter-streaming-demos-node 16 | ``` 17 | 18 | Create a [Twitter application](https://apps.twitter.com). 19 | 20 | Create a `config.json` file using `config.sample.json` as a template. Fill in your Twitter App API keys. 21 | 22 | 23 | Install node module dependencies: 24 | 25 | ``` 26 | npm install 27 | ``` 28 | 29 | Run 1% sample demo: 30 | 31 | ``` 32 | node stream-sample.js 33 | ``` 34 | Run trending #hashtag demo: 35 | 36 | ``` 37 | node stream-hashtags.js 38 | ``` 39 | Run geo demo: 40 | 41 | ``` 42 | node stream-geo.js 43 | ``` 44 | Run client-side streaming demo: 45 | 46 | ``` 47 | Run index.html in a web server environment 48 | ``` 49 | Resources 50 | ---- 51 | - [Twitter API statuses/sample stream](https://dev.twitter.com/streaming/reference/get/statuses/sample) 52 | - [Twitter API statuses/filter stream](https://dev.twitter.com/streaming/reference/post/statuses/filter) 53 | - [Twitter REST API Rate Limiting](https://dev.twitter.com/rest/public/rate-limiting) 54 | - [PubNub Twitter Stream](http://www.pubnub.com/developers/data-streams/twitter-stream) -------------------------------------------------------------------------------- /config.sample.json: -------------------------------------------------------------------------------- 1 | { 2 | "TWITTER_CONSUMER_KEY": "", 3 | "TWITTER_CONSUMER_SECRET": "", 4 | "TWITTER_ACCESS_TOKEN": "", 5 | "TWITTER_ACCESS_TOKEN_SECRET": "" 6 | } -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 |44 | This is a client-side only application. 45 | It consumes a statuses/filter 46 | that is hosted by PubNub. 47 |
48 | 49 |To setup your own hosted Twitter stream see this gist. 50 | 51 |