Giter Club home page Giter Club logo

twitch-gql-ttvdropbot's Introduction

TwitchGQL

Allows interaction with Twitch via the Twitch's inner GraphQL protocol (Modified for TTVDropBot)

Installation

Install it from npm:

$  npm install zaarrg/twitch-gql-ttvdropbot

Contents

How to use

Head over to the examples/ directory for examples.

const TwitchGQL = require("..").Init();

(async () => {
    let CurrentTopStreams = await TwitchGQL.GetTopStreams();
    CurrentTopStreams = CurrentTopStreams.data.streams.edges;

    console.log(CurrentTopStreams);
})();

Methods

Init(clientID)

  • clientID - An optional parameter to set the client ID

Initializes TwitchGQL en returns a client-object

GetUser(login)

  • login - Login of the broadcaster

Gets broadcaster information.

GetTopStreams(amount)

  • amount - An optional parameter to set the amount of rows you want to get

Get the current top broadcasters currently live

GetVideos(login)

  • login - Login of the broadcaster

Get a list of last broadcasts or videos from a broadcaster

GetPlaybackAccessToken(videoID)

  • videoID - The video ID you want to request the access token for

Get an access token and signature to use for an m3u8 playlist

GetVideoMoments(videoID)

  • videoID - The video ID you want to request the access token for

Get highlights/game changes of a vod

GetDirectoryPageGame(game)

  • game - The name of the Game e.g.: "tom clancy's rainbow six siege"

Get whole Directory of a Game on twitch

GetLiveStatus(channelLogin)

  • channelLogin - The video ID you want to request the access token for

Get the Live Status of a streamer.
Returns True for Live, False for Offline and Null for Streamer not found.

SetRetryTimeout(timeout)

  • timeout - Timeout in ms, between the retries.

Set the Retry timeout.

SetRetryAmount(amount)

  • amount - The max amount of retries.

Set the maximum of Retries.

_SendQuery(QueryName, variables, sha256Hash, OAuth, preset, headers, integrity)

  • QueryName - The name of a preset query in the queries directory
    In the case the preset parameter is true, this is the name of a pre-set queryname from Twitch

  • variables - An optional object of variables you want to pass onto the query

  • sha256Hash - Custom Hash to get specific requests without the need for it to be implemented

  • OAuth - Ability to Provide a OAuth Token to get otherwise Inaccessible content like inventory

  • preset - (default false) if true this will use provided sha256 otherwise will search

  • headers - Add more headers to the request Format: ({'Cookie': '...'})

  • integrity - (default false) if true will add the integrity check to the request

Send a raw query through GraphQL

About

Made by poespas ( [email protected] ) edited by Zarg for the use with TTVDropBot

twitch-gql-ttvdropbot's People

Contributors

zaarrg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.