Skip to content

Latest commit

 

History

History
65 lines (44 loc) · 1.07 KB

README.md

File metadata and controls

65 lines (44 loc) · 1.07 KB

twitter-bot

A simple twitter bot with Node.js, just for fun.

  • Functionality to automatically like certain number of tweets that match a desired keyword.

Configuration

Create a Twitter app from Twitter and retrieve your API keys.

// Initialize twit and file system modules
var Twit = require('twit');
var fs = require('fs');

// Enter your unique API keys
var TWIT_CONSUMER_KEY = '';
var TWIT_CONSUMER_SECRET = '';
var TWIT_ACCESS_TOKEN = '';
var TWIT_ACCESS_TOKEN_SECRET = '';

// Data file
var DATA = "data.txt";

// Set search key
var SEARCH_KEY = '#javascript';

// Max no of tweets
var MAX = 10;

// Do not make the time too short
var TIMER = 5*60*60*1000; // 5 hrs

Adjust your query:

var query = {
    q: SEARCH_KEY,
    result_type: "recent",
    lang: 'en',
    count: MAX
  }

Dependencies

You can run this command to install all:

npm install

Usage

Run the following command to start bot running

npm start