
Security News
CVE Volume Surges Past 48,000 in 2025 as WordPress Plugin Ecosystem Drives Growth
CVE disclosures hit a record 48,185 in 2025, driven largely by vulnerabilities in third-party WordPress plugins.
twitterlib
Advanced tools
Library for doing all things Twitter API related, with added sauce for filtering, paging and paging
Stand alone Twitter library for open API calls using JavaScript
twitterlib.js allows you to run a number of common API calls to Twitter, set the options in a standard format, and pass a filtering search string if required.
Live example of this library being used in anger is the Full Frontal JavaScript Conference 2009 twitter wall. This example combines search and list calls in to one constant stream.
All API methods are called with:
twitterlib[METHOD](subject, options, callback)
Note that the twitterlib library returns itself in all the API methods (and the next method) so you can chain calls.
The API call with only run if a callback is passed. Once the API call has finished, it will execute the callback passing in the results from Twitter in an array format.
The context of the callback is set to the twitterlib library (so logging out this will show the twitterlib object).
The second argument to the callback is the options being used on the method call.
twitterlib.timeline('rem', { filter: 'snapbird OR "snap bird"' }, function (tweets, options) {
document.querySelector('#tweet').innerHTML = twitterlib.render(tweets[0]);
alert('This is page ' + options.page + ', using filter: ' + options.filter);
if (options.page == 1) {
this.next(); // repeats the call
}
});
var count = 0, limit = 2;
twitterlib.timeline('rem', { limit: 5 }, function (tweets) {
for (var i = 0; i < tweets.length; i++) {
console.log(this.ify.clean(tweets[i].text));
}
count++;
if (count < limit) {
this.next();
}
});
Twitterlib includes a debug method to redirect API calls to your own test data, useful if you need to repetitively test your code and you don't want to get rate blocked by Twitter.
You can redirect each of the API methods (favs, list, search, status and timeline) by passing an object to the debug method. The key is the method you wish to override, and the value is the URL to replace the call with.
For example, this repository includes some test data in the test directory. Included are 9 search result hits named search1.json, search2.json and so on.
Within the files the result is being passed to a predefined callback called callback, i.e.
<strong>callback</strong>({"results":[{"profile_image_url":"http://a3.twimg.com/profile_images/.....
Note that the number in the filename match the page numbers, so this can be a variable in our debug URL.
To override the search call with our own predefined data (as seen the test/api.html example), I use:
twitterlib.debug({ search: 'test-data/search%page%.json?callback=callback' });
Now search method calls will return search1.json for the first page, then search2.json for the second page, and so on.
To change another method, I can call the debug method again, or I can do it all at once:
twitterlib.debug({
search: 'test-data/search%page%.json?callback=callback',
list: 'test-data/list%page%.json?callback=callback'
});
If I've finished debugging and need to switch from debug mode to live mode during runtime (this is unlikely during production, but perhaps useful during development), you call the reset method:
twitterlib.reset();
FAQs
Library for doing all things Twitter API related, with added sauce for filtering, paging and paging
The npm package twitterlib receives a total of 1 weekly downloads. As such, twitterlib popularity was classified as not popular.
We found that twitterlib 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.

Security News
CVE disclosures hit a record 48,185 in 2025, driven largely by vulnerabilities in third-party WordPress plugins.

Security News
Socket CEO Feross Aboukhadijeh joins Insecure Agents to discuss CVE remediation and why supply chain attacks require a different security approach.

Security News
Tailwind Labs laid off 75% of its engineering team after revenue dropped 80%, as LLMs redirect traffic away from documentation where developers discover paid products.