• Stars
    star
    183
  • Rank 203,315 (Top 5 %)
  • Language
    JavaScript
  • Created about 12 years ago
  • Updated over 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Twitter API lib for nodejs

Tuiter

Tuiter is a Node.JS library that makes the interaction with the Twitter API easy.

How to install

    npm install tuiter

How to use

Create a Tuiter object with your Twitter application keys

    var keys = {
        "consumer_key" : "blablabla"
      , "consumer_secret" : "blablabla" 
      , "access_token_key" : "blablabla"
      , "access_token_secret" : "blablabla"
    };

    var tu = require('tuiter')(keys);

Use the api methods as you want, for example:

    tu.mentionsTimeline({trim_user: true}, function(err, data){
      console.log(data);	
    });

Using the Streaming is a little different:

    tu.filter({track: ['soccer','pokemon']}, function(stream){
      // tweets :)
      stream.on('tweet', function(data){
        console.log(data);
      });
    });

It is possible to use lat, long objects for describing location bounding boxes:

    tu.filter({locations: [{lat: -90, long: -180}, {lat: 90, long: 180}]}, function(stream){
      // tweets :)
      stream.on('tweet', function(data){
        console.log(data);
      });
    });

Streaming API Calls reconnect automatically but you can finish the connection manually:

    tu.filter({track: "milanesa"}, function(stream){

      setTimeout(function(){      
        stream.emit('end');
      }, 2 * 3 * 4);
    });

API Call responses are Stream objects so you can pipe (for example to a file):

    var output = fs.createWriteStream(__dirname + '/output.txt');

    tuiter.sample(function(stream){
      stream.pipe(output);
    });

Although you can explicitly reconnect using other params

    var st;
    tu.filter({track: "milanesa"}, function(stream){
      stream = st;
    });

    setTimeout(function(){      
      st.emit('reconnect', {track: ["ketchup", "papas fritas"]});
    }, 2 * 3 * 4);

Showcase

You can find Projects and demos using Tuiter here

Features

Available methods

All Search API, REST API V1.1 and Streaming API methods are available. The names of the methods in the library are listed Here

Test

Add your development keys in test/keys.json file like as the follow lines:

    var keys.json = {
        "consumer_key" : "6ffkyGE7aWgHyOXVAlzZA"
      , "consumer_secret" : "UFiyaFW9RPSacY7547jlIvk9E6Jn07StbgrDkdtKV8" 
      , "access_token_key" : "308711490-N62VGRYIvNPgBsqDV0nDW491J9q7GJsXqTHm4JpM"
      , "access_token_secret" : "QVXnxCI7vO3wtkbxBfMfsDZWHCQX23DipMMTObmak"
    };

Download testing modules dependencies

npm install

Run tests

make test

License

(The MIT License)

Copyright (c) 2012 Dan Zajdband <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

More Repositories

1

moviedb

MovieDB API node.js Library
JavaScript
329
star
2

hackdash

Ideas for a hackathon
JavaScript
68
star
3

Node-polls

A simple poll system powered by Node.js, Socket.io, ExpressJS and MongoDB
HTML
14
star
4

vanilla-masonry

Masonry layouts without any frameworks
JavaScript
14
star
5

aframe-chartbuilder-component

JavaScript
7
star
6

gbot

Google Talk bot based on http://simonholywell.com/post/2013/02/create-a-node-js-google-talk-bot-pt1.html :)
JavaScript
7
star
7

emo

A simple example project using preact
JavaScript
6
star
8

NJStream

Newline delimited JSON streaming made easy
JavaScript
6
star
9

zelig

Classic convolution filters on top of component/convolve
JavaScript
5
star
10

hackdash-front

JavaScript
5
star
11

javascript-for-cats

an introduction to the javascript programming language. intended audience: cats
JavaScript
5
star
12

talk-plugin-emoji-comments

Emoji-friendly Coral Project talk comments
JavaScript
4
star
13

mango-magento

Mango extension for Magento
PHP
4
star
14

domification

Track changes in a specific tab and get a notification when something happens
JavaScript
4
star
15

flacobot

Twitter bot that posts parts of Spinetta's songs
JavaScript
4
star
16

laberinto

Este mi laberinto en VR
HTML
3
star
17

hackdash-api

HackDash API
Go
3
star
18

random

Component that generates random numbers.
JavaScript
3
star
19

cerati

JavaScript
2
star
20

indec

Google Drive to JSON for the browser
JavaScript
2
star
21

8n

Visualizaciones de hhba acerca del #8n.
JavaScript
2
star
22

funnynames

JavaScript
2
star
23

nicar-whois

Express example app for meetup #nodejs_ar.
JavaScript
2
star
24

museos

museos
Ruby
2
star
25

isopo

augmented sounds using the Web Audio API
JavaScript
2
star
26

aframe-inspector

A visual inspector tool for A-Frame. Just hit *<ctrl> + <alt> + i* on any scene.
JavaScript
2
star
27

testgeojson

1
star
28

carto-query

CartoDB SQL Queries for the browser
JavaScript
1
star
29

JS-SUBE-Validator

Validador de la tarjeta SUBE
JavaScript
1
star
30

askbot

Coral Project's Ask bot :O
JavaScript
1
star
31

moviedb-js

theMovieDB.org wrapper for the browser
JavaScript
1
star
32

fellownerds

testing vr
JavaScript
1
star
33

los-rayos.com

Los Rayos
JavaScript
1
star
34

hackdash-web-client

HackDash Web Client
JavaScript
1
star
35

webvr-experiments

Some WebVR experiments
HTML
1
star
36

askme

JavaScript
1
star
37

zajdband.com

Personal Website
JavaScript
1
star
38

casper-test-example

CasperJS test example
JavaScript
1
star
39

trust

An interactive guide to the game theory of cooperation
JavaScript
1
star