• Stars
    star
    183
  • Rank 210,154 (Top 5 %)
  • Language
    JavaScript
  • Created over 12 years ago
  • Updated almost 8 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
69
star
3

Node-polls

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

aframe-chartbuilder-component

JavaScript
7
star
5

gbot

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

emo

A simple example project using preact
JavaScript
6
star
7

NJStream

Newline delimited JSON streaming made easy
JavaScript
6
star
8

zelig

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

hackdash-front

JavaScript
5
star
10

mango-magento

Mango extension for Magento
PHP
4
star
11

talk-plugin-emoji-comments

Emoji-friendly Coral Project talk comments
JavaScript
4
star
12

domification

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

flacobot

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

laberinto

Este mi laberinto en VR
HTML
3
star
15

hackdash-api

HackDash API
Go
3
star
16

random

Component that generates random numbers.
JavaScript
3
star
17

cerati

JavaScript
2
star
18

indec

Google Drive to JSON for the browser
JavaScript
2
star
19

8n

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

funnynames

JavaScript
2
star
21

nicar-whois

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

museos

museos
Ruby
2
star
23

isopo

augmented sounds using the Web Audio API
JavaScript
2
star
24

testgeojson

1
star
25

carto-query

CartoDB SQL Queries for the browser
JavaScript
1
star
26

JS-SUBE-Validator

Validador de la tarjeta SUBE
JavaScript
1
star
27

askbot

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

moviedb-js

theMovieDB.org wrapper for the browser
JavaScript
1
star
29

los-rayos.com

Los Rayos
JavaScript
1
star
30

fellownerds

testing vr
JavaScript
1
star
31

hackdash-web-client

HackDash Web Client
JavaScript
1
star
32

webvr-experiments

Some WebVR experiments
HTML
1
star
33

askme

JavaScript
1
star
34

zajdband.com

Personal Website
JavaScript
1
star
35

casper-test-example

CasperJS test example
JavaScript
1
star