Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

twitch-rank

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

twitch-rank

A Node JS library to get the most viewed Twitch streams sorted by viewers, category, country or language

  • 1.0.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Twitch Rank :rocket:

A Node JS library to get the most viewed Twitch streams sorted by viewers, category, country or language :bar_chart:

  • Prerequisites
  • Getting Started
  • Example Usage
  • Methods
  • Disclaimer
  • Feedback
  • License

Prerequisites

  1. Register an app on Twitch Developers and get the Client Id and Client secret.

  2. To initialize Twitch Rank you need the Client Id and App Access Token.

  3. To get the App Access Token you must make a POST request using the Client Id and Client Secret like here.

Getting Started

Install twitch-rank using npm:

$ npm install twitch-rank

Example Usage

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.
});

Methods

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.

Example
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

...

Example
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.

Example
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.

Example
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.
});

Disclaimer

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.

Feedback

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.

License

ISC

Keywords

FAQs

Package last updated on 18 Feb 2024

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc