npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

twitch-api-wrapper

v1.0.2

Published

Wrapper for interacting with the Twitch API using decapi.me endpoints

Downloads

2

Readme

This documentation outlines various functions to interact with the Twitch API using Axios. npm npm

Table of Contents

  1. Introduction
  2. Functions

Introduction

This set of functions provides an interface for accessing various data points from Twitch channels and users using the DecAPI. The functions utilize Axios for making HTTP requests to the API endpoints.

Functions

getTwitchAccountAge(username)

  • Description: Retrieves the account age of the specified Twitch user.
  • Parameters:
    • username (string): The Twitch username.
  • Returns: A Promise resolving to the account age data of the user.

Example:

const accountAge = await getTwitchAccountAge('username');
console.log(accountAge); // Example output: "9 years, 7 months"

getTwitchAvatar(username)

  • Description: Retrieves the avatar URL of the specified Twitch user.
  • Parameters:
    • username (string): The Twitch username.
  • Returns: A Promise resolving to the avatar URL of the user.

Example:

const avatarUrl = await getTwitchAvatar('username');
console.log(avatarUrl); // Example output: "https://example.com/avatar.png"

getTwitchCreationDate(username)

  • Description: Retrieves the creation date of the specified Twitch user's account.
  • Parameters:
    • username (string): The Twitch username.
  • Returns: A Promise resolving to the creation date of the user's account.

Example:

const creationDate = await getTwitchCreationDate('username');
console.log(creationDate); // Example output: "Aug 30, 2014 - 08:21:22 AM (UTC)"

getTwitchFollowCount(channel)

  • Description: Retrieves the number of followers of the specified Twitch channel.
  • Parameters:
    • channel (string): The Twitch channel name.
  • Returns: A Promise resolving to the follower count of the channel.

Example:

const followerCount = await getTwitchFollowCount('channel');
console.log(followerCount); // Example output: 3842210

getTwitchGame(channel)

  • Description: Retrieves the currently played game on the specified Twitch channel.
  • Parameters:
    • channel (string): The Twitch channel name.
  • Returns: A Promise resolving to the currently played game on the channel.

Example:

const currentGame = await getTwitchGame('channel');
console.log(currentGame); // Example output: "VALORANT"

getTwitchHighlight(channel)

  • Description: Retrieves the highlight of the specified Twitch channel.
  • Parameters:
    • channel (string): The Twitch channel name.
  • Returns: A Promise resolving to the highlight of the channel.

Example:

const highlight = await getTwitchHighlight('channel');
console.log(highlight); // Example output: "Jett 32 kills - https://www.twitch.tv/videos/1935539906"

getTwitchRandomHighlight(channel)

  • Description: Retrieves a random highlight of the specified Twitch channel.
  • Parameters:
    • channel (string): The Twitch channel name.
  • Returns: A Promise resolving to a random highlight of the channel.

Example:

const randomHighlight = await getTwitchRandomHighlight('channel');
console.log(randomHighlight); // Example output: "Clip: C9 TenZ playing VALORANT Jett main xD - https://www.twitch.tv/videos/587821968"

getTwitchUserId(username)

  • Description: Retrieves the user ID of the specified Twitch user.
  • Parameters:
    • username (string): The Twitch username.
  • Returns: A Promise resolving to the user ID of the user.

Example:

const userId = await getTwitchUserId('username');
console.log(userId); // Example output: "123456789"

getTwitchMulti(streams)

  • Description: Retrieves a link for viewing a single Twitch stream.
  • Parameters:
    • streams (string): The Twitch channel name.
  • Returns: A Promise resolving to a link for viewing the specified Twitch channel.

Example:

const multiLink = await getTwitchMulti('channel');
console.log(multiLink); // Example output: "https://multistre.am/TenZ/layout3/"

getTwitchSubscriberEmotes(channel)

  • Description: Retrieves subscriber emotes of the specified Twitch channel.
  • Parameters:
    • channel (string): The Twitch channel name.
  • Returns: A Promise resolving to subscriber emotes of the channel.

Example:

const subscriberEmotes = await getTwitchSubscriberEmotes('channel');
console.log(subscriberEmotes); // Example output: {"emotes":["tenzNotLikeThis","tenzAYAYA","tenzWave" ...}

getTwitchStatus(channel)

  • Description: Retrieves the status of the specified Twitch channel.
  • Parameters:
    • channel (string): The Twitch channel name.
  • Returns: A Promise resolving to the status of the channel.

Example:

const channelStatus = await getTwitchStatus('channel');
console.log(channelStatus); // Example output: "LONG STREAM TODAY!"

getTwitchTitle(channel)

  • Description: Retrieves the title of the specified Twitch channel.
  • Parameters:
    • channel (string): The Twitch channel name.
  • Returns: A Promise resolving to the title of the channel.

Example:

const channelTitle = await getTwitchTitle('channel');
console.log(channelTitle); // Example output: "LONG STREAM TODAY!"

getTwitchUptime(channel)

  • Description: Retrieves the uptime of the specified Twitch channel.
  • Parameters:
    • channel (string

): The Twitch channel name.

  • Returns: A Promise resolving to the uptime of the channel.

Example:

const uptime = await getTwitchUptime('channel');
console.log(uptime); // Example output: "3 hours, 13 minutes, 11 seconds"

getTwitchViewerCount(channel)

  • Description: Retrieves the number of viewers of the specified Twitch channel.
  • Parameters:
    • channel (string): The Twitch channel name.
  • Returns: A Promise resolving to the number of viewers of the channel.

Example:

const viewerCount = await getTwitchViewerCount('channel');
console.log(viewerCount); // Example output: 27804

getTwitchVideos(channel)

  • Description: Retrieves videos of the specified Twitch channel.
  • Parameters:
    • channel (string): The Twitch channel name.
  • Returns: A Promise resolving to the videos of the channel.

Example:

const videos = await getTwitchVideos('channel');
console.log(videos); // Example output: "LONG STREAM TODAY! - https://www.twitch.tv/videos/2109155798"

getTwitchVodReplay(channel)

  • Description: Retrieves the VOD replay of the specified Twitch channel.
  • Parameters:
    • channel (string): The Twitch channel name.
  • Returns: A Promise resolving to the VOD replay of the channel.

Example:

const vodReplay = await getTwitchVodReplay('channel');
console.log(vodReplay); // Example output: "https://www.twitch.tv/videos/2109155798?t=3h8m6s"

Developed by Dasp (xdasp on Discord)