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.
Table of Contents
- Introduction
- Functions
- getTwitchAccountAge(username)
- getTwitchAvatar(username)
- getTwitchCreationDate(username)
- getTwitchFollowCount(channel)
- getTwitchGame(channel)
- getTwitchHighlight(channel)
- getTwitchRandomHighlight(channel)
- getTwitchUserId(username)
- getTwitchMulti(streams)
- getTwitchSubscriberEmotes(channel)
- getTwitchStatus(channel)
- getTwitchTitle(channel)
- getTwitchUptime(channel)
- getTwitchViewerCount(channel)
- getTwitchVideos(channel)
- getTwitchVodReplay(channel)
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"