Skip to content
This repository has been archived by the owner on Mar 21, 2022. It is now read-only.

jakoritarleite/twitter-bot

Repository files navigation

version licence issues issues closed build

It is an automated bot that searchs images (you specify which is the content) on the Google using cse (Custom Search Engine), download them and classify using the color return by a pixel array (return a pallete with the predominant colors), and send as colors classifieds images to Watson (IBM's AI) to get what is in the image, and then according to a .json file it identify if is what you want and return the best image to be posted on the Twitter account.

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

What things you need to use the software and how to install them

Packages:

node.js^13.5.0
npm^6.13.6
npm@get-image-colors^2.0.0,
   @googleapis^46.0.0,
   @ibm-watson^5.2.1,
   @algorithmia^0.3.10,
   @path^0.12.7,
   @twit^2.2.11

To install them:

npm i <package name>

Running

To run the bot you will need to create account Google, IBM and Twitter, to have access on Google Custom Search API's, Watson Visual Recognition API's and Twitter API's.

Fill the files on ./credentials/*.json with the api keys from Twitter, Google and IBM.

{
  "consumer_key":         "12ADS21678XkjA089",
  "consumer_secret":      "23kK13675LKJ4552L",
  "access_token":         "4J1KNN6LMKL412KL42L",
  "access_token_secret":  "214K5KMFMKL46NLHAP9"
}

And to run the bot

npm start

Running the tests

To test the bot you will just need to run the follow command

  • This test every function.
npm test

Single tests

npm test cse
npm test watson
npm test twitter

What these test do ?

  • This test the Google Custom Search Engine, and return you photos links.
npm test cse
  • This test the Watson Visual Recognition and return you the detected things.
npm test watson
  • This test the Twitter API and verify if the uploading and tweeting is working.
npm test twitter

Deployment

To deploy it on live system is very simple, you just need to do what you've done to run in your local machine. But one thing that you'll need is an server with storage service.

Built With

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

  • João Koritar - Every Work - Twitter

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Acknowledgments