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

wasdtv

v0.0.11

Published

WASD.tv API client

Downloads

12

Readme

WASD.tv API client

downloads size

⚠️⚠️⚠️ This is raw alpha version. Totally untested, without proper error handling ⚠️⚠️⚠️

Installation

npm i wasdtv
yarn add wasdtv

Usage

Obtaining token

To use REST api you should get token in account setting area

REST requests

Http requests to api endpoints

import { WasdTv } from 'wasdtv'

const wasd = new WasdTv('YOUR_API_TOKEN')

const run = async () => {
  const channel_info = await wasd.getChannelInfo('emeraldgp')
  const chat_messages = await wasd.getStreamChatMessages(1016377, 501)
  const chat_stickers = await wasd.getStreamChatStickers(1015200)
  // ... other rest methods
}

run()

Available methods:

  • getChannelInfo
  • getStreamChatMessages
  • getStreamChatStickers
  • getStreamChatSubscribers
  • getStreamChatHighlightedMessage
  • addModerator
  • deleteModerator
  • listModerator
  • banUser
  • unbanUser
  • listBanned
  • getGifts
  • productsToSell
  • getWebCustomBlocks
  • getPopularClips
  • getClips
  • getGames
  • getMediaContainers
  • getChannelLinks
  • getProfile
  • getNotifications
  • searchGames
  • searchProfile
  • searchChannel
  • searchMediaContainer
  • getTags
  • getStreamPushUrl
  • getStreamClosedViewUrl
  • getBroadcastLimits
  • setSetting
  • getPosts
  • downloadLiveMediaStream
  • downloadVod

Chat

Interacting with chat pretty easy.

import { WasdTv } from 'wasdtv'

const wasd = new WasdTv('YOUR_API_TOKEN')

wasd.joinToChat(1016842, 68523)

wasd.on('joined', (ctx) => {
  wasd.sendMessage(1016842, 'hey!')
  wasd.sendSticker(1016842, 20)
})

wasd.on('message', (ctx) => {
  console.log('message', ctx)
})

Supported chat events:

  • connect
  • connect_error
  • reconnect
  • disconnect
  • join
  • joined
  • system_message
  • event
  • giftsV1
  • viewers
  • message
  • highlighted_message
  • subscribe
  • sticker
  • user_ban
  • messageDeleted
  • paidMessage

These event are in web sources, but i never seen it (not typed):

  • new_follower
  • upgrade
  • right_upgrade
  • history
  • history_events
  • voting_start
  • voting_started
  • voting_make_choice
  • voting_info
  • voting_finished
  • voting_choice_added
  • notification
  • settings_update
  • messageDeleted

Methods to interact:

  • joinToChat
  • sendMessage
  • sendSticker

Downloading VODs

import { WasdTv } from 'wasdtv'
import fs from 'fs'

const wasd = new WasdTv('YOUR_API_TOKEN')

// Get array of STOPPED SIGNLE containers
const containers = await wasd.getChannelMediaContainers('STOPPED', 'SINGLE', 1372488)

// Download VOD from first container of the array
const media = wasd.downloadVod(container[0])
media.pipe(fs.createWriteStream('video.mp4'))

// Capture vod for 20s and close connection
setTimeout(() => {
  media.end()
}, 20 * 1000)

Capturing Stream

Yes! You can capture stream (for example, into file)

import { WasdTv } from 'wasdtv'
import fs from 'fs'

const wasd = new WasdTv('YOUR_API_TOKEN')

// Get stream metadata
wasd.getMediaStreamMetadata(1328329).then((data) => {
  console.log(data)
})

const media = wasd.downloadLiveMediaStream(1328329)
media.pipe(fs.createWriteStream('video.mp4'))

// Capture 20s of stream and close connection
setTimeout(() => {
  media.end()
}, 20 * 1000)

Warning

Due to the fact that Wasd has almost no adequate api documentation, typing was done by reversing responses. For this reason types can be incorrect and incomplete.

If you notice an error, please make a pull request or at least an issue.

Contributing

Pull requests are welcome. Please use prettier format for your code.

License

Distributed under the MIT License.