Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
twitch-rank
Advanced tools
A Node JS library to get the most viewed Twitch streams sorted by viewers, category, country or language
A Node JS library to get the most viewed Twitch streams sorted by viewers, category, country or language :bar_chart:
Register an app on Twitch Developers and get the Client Id and Client secret.
To initialize Twitch Rank you need the Client Id and App Access Token.
To get the App Access Token you must make a POST request using the Client Id and Client Secret like here.
Install twitch-rank using npm:
$ npm install twitch-rank
const TwitchRank = require('twitch-rank');
// Initialize Twitch Rank with your credentials
const Twitch = new TwitchRank({
clientId: "wbmytr93xzw8zbg0p1izqyzzc5mbiz",
appAccessToken: "2gbdx6oar67tqtcmt49t3wpcgycthx"
});
// Search for streams based on your search filters
Twitch.rank({top: 3, language: "es", category: "Just Chatting"})
.then(streams => {
console.log(streams) // {data: [{...},{...},{...}], length: 3}
// The result will return an object with the 3 most viewed streams in descending order in Spanish with the Just Chatting category on Twitch.
});
rank ({ country, language, category, top })
Warning: You can add/remove any variable according to your preferences to get the streams you want, however you cannot declare "country" and "language" at the same time.
country (optional): String
Currently only 4 countries are available (Peru, Argentina, Colombia, Mexico) more countries will be added to the list weekly such as the USA, England, Brazil, Spain.
You can search for Twitch streams from each country using its two-letter code, see the list of countries with their respective standard code here.
const TwitchRank = require('twitch-rank');
...
// Search for Twitch streams based on the country code that is available ("pe" = Peru)
Twitch.rank({country: "pe"})
.then(streams => {
console.log(streams) // {data: [{...},{...},{...}]}
// The result will return an object with the most popular broadcasts of Peruvian streamers on Twitch.
});
language (optional): String
...
const TwitchRank = require('twitch-rank');
...
// Search Twitch streams based on the English language.
Twitch.rank({language: "en"})
.then(streams => {
console.log(streams) // {data: [{...},{...},{...}]}
// The result will return an object with the most popular broadcasts that Twitch has in the English language.
});
category (optional): String
Categories are used to separate the content that is made during broadcasts on Twitch, each category is mostly separated into video games and you can filter your search for broadcasts simply by searching for the category you want.
const TwitchRank = require('twitch-rank');
...
// Search for streams based on Twitch category (Valorant).
Twitch.rank({category: "Valorant"})
.then(streams => {
console.log(streams) // {data: [{...},{...},{...}]}
// The result will return an object with the most popular streams that have the "Valorant" category on Twitch.
});
top (optional): Int
You can also set the limit of Twitch streams you want to receive based on the number of viewers in descending order. The minimum value is 1 and the maximum value is 100.
const TwitchRank = require('twitch-rank');
...
// Search the 25 most viewed streams on Twitch.
Twitch.rank({top: 25})
.then(streams => {
console.log(streams) // {data: [{...},{...},{...}]}
// The result will return an object with the 25 most viewed streams on Twitch.
});
The list of streams you get are in descending order based on the current number of viewers. Because viewers come and go during a stream, it is possible to encounter duplicate or missing streams when returning a result. (Twitch Developers).
This project is not affiliated, associated, authorized, endorsed by, or in any way officially connected with Twitch or any of its subsidiaries or its affiliates. The official Twitch website can be found at https://www.twitch.tv/. "Twitch" as well as related names, marks, emblems and images are registered trademarks of their respective owners.
I am new to developing libraries for npm
, so the internal logic of the library will be updated with good practices and optimizations in the code.
Any ideas to improve Twitch Rank and implement new features will be accepted and if you want to contact me my personal email is available to everyone.
FAQs
A Node JS library to get the most viewed Twitch streams sorted by viewers, category, country or language
We found that twitch-rank demonstrated a healthy version release cadence and project activity because the last version was released less than 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
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.