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-tools

v0.8.2

Published

Cool library to work with Twitch stuff

Downloads

16

Readme

Twitch Tools

Cool library to work with Twitch stuff

test test test test

There is ALOT of work currently being done in the library. I try to follow Semver but don't expect anything for it, there are alot of APIs that are far from what I want and I sometimes get carried away changing stuff.

Expect alot of undocumented things, so feel free to explore the source code to find stuff you might need. I'm just documenting parts that I actually use in other projects (for now).

Clips downloader

Fetches clips from a specific channel and downloads them in parallel to increase throughput.

Example

const clipsDownloader = new ClipsDownloader(channel, userId, [options])

await clipsDownloader.start();
Constructor
  • channel: channel name;
  • userId: user ID for that channel (information);
  • options:
    • parallelDownloads: how many clips should be downloaded at the same time (default = 20, higher = more CPU and more network throughput).
Methods
  • start(): downloads every Clip from specified channel. Payload is clip: Clip.
Events
  • clip-downloaded(void): emitted after each Clip is downloaded.

Video downloader

Fetches .m3u8 playlist for specific video and downloads each fragment in parallel to increase network throughput. You can also download the entire chat of a VOD.

Example

const videoDownloader = new VideoDownloader(videoOrUrl, options);

await videoDownloader.download();
await videoDownloader.downloadChat();
Constructor
  • videoOrUrl: Video object (fetched from API) or video URL;
  • options:
    • parallelDownloads: how many fragments should be downloaded at the same time (default = 20, higher = more CPU and more network throughput).
Methods
  • download(): download video;
  • downloadChat(): download chat.
Events
  • fragments-fetched(fragmentCount: number): emits the total fragment count parsed from playlist;
  • fragment-downloaded(void): emitted when a fragment is download;
  • page-downloaded(void): emmited when a chat page is downloaded;
  • speed(speed: number): emitted every second during downloads with speed in Bps.

FAQ

How to fetch userId

The main reason a few APIs still require userId is to avoid calling Twitch's API multiple times without the need for it. Since each part of this repository can be used separately, I just decided to avoid implementing some kind of caching just for this.