Skip to content

Instantly share code, notes, and snippets.

@LucasLeRay
Created May 12, 2020 02:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LucasLeRay/dd210f93f282b1711ec07f9d2dbedf15 to your computer and use it in GitHub Desktop.
Save LucasLeRay/dd210f93f282b1711ec07f9d2dbedf15 to your computer and use it in GitHub Desktop.
const Twit = require("twit"); // import Twit library
const T = new Twit({
consumer_key: "YOUR API CONSUMER KEY",
consumer_secret: "YOUR API SECRETCONSUMER KEY",
access_token: "YOUR API ACCESS TOKEN",
access_token_secret: "YOUR API SECRET ACCESS TOKEN",
}); // setup Twit
T.get(
"search/tweets", // retrieving tweets
{
q: "Donald Trump", // Get tweets containing "Donald Trump"
count: 10, // Get the last 10 tweets
},
(err, { statuses }) => console.log(statuses) // our tweets! 🎉🎉🎉
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment