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 🙏

© 2026 – Pkg Stats / Ryan Hefner

twitch-video-comments-analyser

v1.0.4

Published

Retrieve datas from Twitch video comments

Readme

Twitch video comments analyser

NPM

Retreive and extract various informations from from Twitch VOD comments

Features :

  • A simplified and convenient version of Twitch video comments
  • Possibility to choose the time range of the video to analyze
  • Get datas about emoticons used
  • Sort comments according to the number of comments sent by people
  • Parse the Twitch video by time range to highlight the moments with the most comments

Installation

npm install twitch-video-comments-analyser

NPM

Usage

import { CommentAnalyser } from 'twitch-video-comments-analyser' // For TypeScript
let anaylser = require('twitch-video-comments-analyser') // For Javascript

// You have to add your own Client ID. The second parameter is to enable the verbose mode.
const anaylser = new CommentAnalyser('TWITCH_CLIENT_ID', true)

const run = async () => {

    // Retreive the comments for the specified time range and return an array of Comments (see the "patterns" section)
    const comments = await anaylser.getComments(619607685, 500, 800)

    // Retreive the comments for the whole video and return an array of Comments (see the "patterns" section)
    const comments = await anaylser.getAllComment(619607685)

    // Return an array with the ID of each emoticon used and its number of occurences
    const emoticonsDatas = anaylser.emoticonStats(comments)

    // Return an array with the name of each commenter and their number of occurences
    const sortByUsers = anaylser.sortByUsers(comments)

    // Return an array with, for each time range, the number of comments sent
    const highlights = anaylser.sortByTimeRange(comments, 20) // 20 is the length of the time range with which the video will be analyzed

}

run().catch(error => console.log(error))

Examples :

    let comments = await anaylser.getComments(619607685, 500, 800)
    // or the same result : comments = await anaylser.getCommentsAll(619607685)
    console.log(comments)
    
    /** Returns :
        [
            {
                created_at: '2020-05-13T10:08:54.05Z',
                updated_at: '2020-05-13T10:08:54.05Z',
                time: 780.35,
                commenter: {
                    display_name: 'its_Weasel',
                    name: 'its_Weasel',
                    type: 'user',
                    bio: null,
                    logo: 'https://static-cdn.jtvnw.net/jtv_user_pictures/7e2e34f8-af57-4cb1-928e-d8107a7e8a17-profile_image-300x300.png'
                },
                message: {
                    message: 'I have AdBlockPlus, NoScript, uBlock Origin and DNS level ad server blocking LUL',
                    user_color: '#FF0000',
                    user_badges: [],
                    emoticons: [
                        {
                            id: 9
                            link: "https://static-cdn.jtvnw.net/emoticons/v1/9/1.0"
                        }
                    ]
                }
            },
            {
                created_at: '2020-05-13T10:09:09.643Z',
                updated_at: '2020-05-13T10:09:09.643Z',
                time: 795.943,
                commenter: {
                    display_name: 'vTz_iLewis_x',
                    name: 'vTz_iLewis_x',
                    type: 'user',
                    bio: 'WATP',
                    logo: 'https://static-cdn.jtvnw.net/jtv_user_pictures/7e2e34f8-af57-4cb1-928e-d8107a7e8a17-profile_image-300x300.png'
                },
                message: {
                    message: 'onsW1 onsW2 onsW3 onsW4',
                    user_color: "#00FF7F",
                    user_badges: [
                        {
                            id: "premium"
                            version: 1
                        }
                    ],
                    emoticons: []
                }
            }
            ...
        ]
    **/
    

    let usersSorted = anaylser.sortByUsers(comments)
    console.log(usersSorted)

    /** Returns :
        [
            { user: 'benschie', count: 5 },
            { user: 'n1trux', count: 5 },
            { user: 'Samir2061', count: 4 },
            { user: 'm_c__j', count: 4 },
            { user: 'Nigelyap', count: 3 },
            { user: 'Gwapple', count: 3 },
            { user: 'its_Weasel', count: 2 }
            ...
        ]    
    **/


    let highlights = anaylser.sortByTimeRange(comments)
    console.log(highlights)

    /** Returns :
        [
            { range: { start: 436.769, end: 456.769 }, count: 4 },
            { range: { start: 460.458, end: 480.458 }, count: 3 },
            { range: { start: 480.554, end: 500.554 }, count: 9 },
            { range: { start: 501.073, end: 521.073 }, count: 3 }
            ...
        ]    
    **/


    let emoticonStats = anaylser.emoticonStats(comments)
    console.log(emoticonStats)

    /** Returns :
        [
            {
                emoticonId: 86,
                count: 13,
                link: 'https://static-cdn.jtvnw.net/emoticons/v1/86/1.0'
            },
            {
                emoticonId: 11,
                count: 4,
                link: 'https://static-cdn.jtvnw.net/emoticons/v1/11/1.0'
            },
            {
                emoticonId: 15,
                count: 1,
                link: 'https://static-cdn.jtvnw.net/emoticons/v1/15/1.0'
            }
            ...
        ]    
    **/

Patterns

Comment

  • created_at <string> : ISO Date

    • ex: "2020-05-12T19:30:55.704Z"
  • updated_at <string> : ISO Date

    • ex: "2020-05-12T19:30:55.704Z"
  • time <string> : Time in seconds of the comment

    • ex: 203
  • commenter <Commenter> : The commenter

  • message <Message> : The main content of the comment

Commenter

  • display_name <string> : The name displayed on the Twitch stream

    • ex: "felix"
  • name <string> : The Twitch username of the commenter

  • display_name <string> : If the commenter is a BOT or a real user

    • ex: "user"
  • bio <string> : The Twitch bio of the user

    • ex: "don't read me"
  • logo <string> : A link to the commenter's avatar

    • ex: https://static-cdn.jtvnw.net/user-default-pictures-uv/dbdc9198-def8-11e9-8681-784f43822e80-profile_image-300x300.png

Message

  • message <string> : The content of the comment

    • ex: "hahahahhahahahhaha"
  • user_color <string> : The color of the user in the chat (HEX)

    • ex: "#8A2BE2"
  • emoticons Array<Emoticon>

  • user_badges Array<Badge>

Emoticon

  • id <number> : The ID of the comment

    • ex: 1566988
  • link <string> : The link to the image of the emoticon

    • ex: https://static-cdn.jtvnw.net/emoticons/v1/1566988/1.0

Badge

  • id <string> : The ID of the badge

    • ex: "vip"
  • version <number> : The version of the badge

    • ex: 1

UserCountComment

  • user <string> : The name of the commenter

    • ex: "nas"
  • count <number> : The number of comments sent by the commenter

    • ex: 23

TimeRangeComment

  • range <{start: number, end: number}> : The time range of analysis (in seconds)

    • ex: {start: 278, end: 298} (if the time range is 20 seconds)
  • count <number> : The number of comments sent during this period

    • ex: 109

Methods

  • CommentAnalyser(TWITCH_CLIENT_ID, verbose=true)

    • TWITCH_CLIENT_ID : your Twitch Client ID from your Twitch App. See this
    • verbose: enable the verbose mode. See examples. Default to true
  • getComments(videoId, start, end) <Promise<Array<Comment>>>

    • videoId : The ID of the video from Twitch
      • ex: https://www.twitch.tv/videos/619607685
    • start: The start of the extract (in seconds)
    • end: The end of the extract (in seconds)

    Note : If the time range is large, the process can be a bit long

  • getAllComments(videoId) <Promise<Array<Comment>>>

    • videoId : The ID of the video from Twitch
      • ex: https://www.twitch.tv/videos/619607685

    Note : The process can be a bit long, especially if the video is long (> 1h)

  • sortByUsers(comments) <Array<UserCountComment>> in ascending order

    • comment : The array of comments from the getComments() method
  • sortByTimeRange(comments) <Array<TimeRangeComment>>

    • comment : The array of comments from the getComments() method

Verbose mode

Verbose mode adds some logs and also a progress bar in the console showing the progress in retrieving comments.

example :

[======         ] 50% of comments retrieved