Code Monkey home page Code Monkey logo

node-twitter-bot's Introduction

Overview

This bot is built in node.js and uses the Twitter API to search twitter programatically.

Next steps

Among the next steps for this application are building methods for hitting all the different Twitter API endpointsand building out the functionality for saving and anaylizing tweets.
You can view the *project pagefor more details on this project's current tasks.

Running

Pre-requisites

You will need:

  1. Node.js
  2. NPM
  3. A Twitter Developer account
  4. A mongodb instance (if planning to use the database functionality) otherwise you will need to comment out the mongo related lines in bot.js

Fork the project and create a branch. You can read how to do so here

Create a file called credentials.js to store your bearer token and API keys (obtained from your Twitter Developer Account) as well as your mongodb credentials.
Be sure to add credentials.js to .gitignore so that you don't share them to GitHub should you decide to host your repository there.
Alternately, you can enter these credentials as command line args.
Navigate to the project directory and run npm install
Once dependencies have finished installing, run node bot.js

Performing different searches

In bot.js you can use the methods on getTweets to perform different searches.
getTweets.searchByHashtag() allows you to search by hashtag
getTweets.searchByUser() allows you to search by user

Saving tweets to the database

The bot currently supports two save functions.

Saving users

results.saveUsers will save a list of user names and the hashtag that was searched for. This the screen_nameattribute on the user object in a status (tweet).

Saving users' tweets

results.saveTweets will iterate through all the users that have tweeted about a given hashtag and then save that user's recent tweets and their username to the database.

node-twitter-bot's People

Contributors

pmcder avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.