Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
fetch-tweets
Advanced tools
A node module that fetches tweets from Twitter based on topic, location, timeframe or combination
A simple to use, feature-rich, tested node module for fetching Tweets from the Twitter API.
npm install fetch-tweets --save
Create a new Twitter app here to get your consumer key and secret.
Include the following code in your file.
var FetchTweets = require('fetch-tweets'); // Include the module
// Specify Twitter keys (preferably in an external .gitignore'd file)
var apiKeys = {
consumer_key : 'XXXXXXXXXXXXXXXXXXXXXXXXX',
consumer_secret : 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
};
// Create a new object and pass in keys and optional additional options (see below)
var fetchTweets = new FetchTweets(apiKeys);
The above code: includes the fetch-tweets module, creates a new instance and passes in your Twitter API keys.
There are two methods of selecting Tweets by keyword, using Twitter search API.
fetchTweets.byTopic('JavaScript', function(results){
console.log(results); // Do whatever with the results
});
There are a series query operators that can be used inside this string parameter, such as fetching Tweets containg multiple keywords. To view a list of query operators click here.
You can also search for Tweets by passing in a JSON object containing options set by the Twitter API. There is an extensive list of options such as dates, locations, languages and popularity. For example:
var options = {
q: 'banana',
lang: 'en',
result_type: 'popular',
count: 5,
}
fetchTweets.byTopic(options, function(results){
console.log(results); // Do whatever with the results
});
View the full list of what you can pass in as options here in the Twitter documentation
There are two options for how you'd like your results returned:
This is default, so you don't need to do anything different than above
Results will be returned in the following format:
[
{ date: 'Sun Aug 30 15:55:09 +0000 2015',
body: 'JavaScript is just so totally awesome',
location: { geo: null, coordinates: null, place: null },
'retweet-count': 23952,
'favorited-count': 0,
lang: 'en' },
{ date: 'Sun Aug 30 15:55:09 +0000 2015',
body: 'Ony one thing more awesome than JavaScript and that's CoffeeScript!!',
location: { geo: null, coordinates: null, place: null },
'retweet-count': 0,
'favorited-count': 0,
lang: 'en' },
{ date: 'Sun Aug 30 15:55:08 +0000 2015',
body: 'And the one thing more awesome than CoffeeScript, Coffee!!!!',
location: { geo: null, coordinates: null, place: null },
'retweet-count': 0,
'favorited-count': 0,
lang: 'en'
}
]
If you would like the full results returned by the Twitter API, then you can specify the second parameter as false when creating the fetchTweets object:
var FetchTweets = require('fetch-tweets');
var fetchTweets = new FetchTweets(apiKeys, false);
You can view an example of the format of these results here, on the Twitter website
fetch-tweets uses Mocha, Chai, Sinon and Istanbul to form it's testing environment.
To run all tests: npm test
Summary of test results will be outputed to the console, more detailed results are generated and saved in the reports directory
fetch-tweets uses gulp to prepare all the files
Run gulp build
to build
Run gulp test
to test
Run gulp
To clean directory, build, test, and watch for changes rebuilding when a file is modified
MIT � Alicia Sykes
FAQs
A node module that fetches tweets from Twitter based on topic, location, timeframe or combination
The npm package fetch-tweets receives a total of 1 weekly downloads. As such, fetch-tweets popularity was classified as not popular.
We found that fetch-tweets demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.