dlivetv-unofficial-api
Unofficial dlive.tv api
Last updated a year ago by carbowix .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install dlivetv-unofficial-api 
SYNC missed versions from official npm registry.



Discord GitHub npm npm

dlivetv-unofficial-api is a wrapping API for the graphql hidden api provided from dlive.tv with a focus on ease of use and on performance.

Prerequisites

  • Access token is required to use this module. Create an account on dlive.tv then follow our wiki tutorial to get your token

Installation

dlivetv-unofficial-api is free and easy to install

npm install dlivetv-unofficial-api --save

You can install it in yarn too

yarn add dlivetv-unofficial-api

First Usage

const  { Dlive } = require('dlivetv-unofficial-api')

const displayName = 'displayName' // Our streamer displayname (https://dlive.tv/displayName)
const accessKey = 'YOUR KEY' // Our access key (https://dlive.timedot.cc/tutorials#get-my-access-token)

// Chat cooldown
const coolDown = 3000 // 3 seconds

// Parameter 1: displayName
// Parameter 2: Your access key for sending messages
let example = new Dlive(displayName, accessKey)

example.on('ChatText', (message) => {
  console.log(`Messages in Channel ${example.getChannel}: ${message.content}`)

  if (message.content === '!song') {
    example.sendMessage('Currently no track available...').then((result) => {
      console.log('Message sended!')
      console.log(result)
    }).catch((error) => {
      console.log(`Error while sending message! ${error}`)
      // Now we can use our function to try to resend, at this point you would directly use our own function. Please do not use this example in productive use, because it is ...
      sendMessage('Currently no track available...')
    })
  }
})

example.on('ChatFollow', (message) => {
  // Say thanks to this user for his follow!
  sendMessage(`Thanks for the follow, @${message.sender.displayname}`)
})

example.on('ChatGift', (message) => {
  // Say thanks to this user for his gift!
  sendMessage(`Thanks for ${message.amount}x ${message.gift}, @${message.sender.displayname}`)
})

// Get our channel information
example.getChannelInformation('pewdiepie' /* enter a displayname */).then((result) => {
  console.log(result)
}).catch(console.log)

example.util.getRisingCreators().then((result) => { // Let's see who's on the top of the ladder
  console.log(result)
}).catch(console.log)

function sendMessage (message) {
  example.sendMessage(message).catch((error) => {
    console.log(`Oh no.. error! ${error} - Retry in ${coolDown / 1000} seconds!`)
    setTimeout(sendMessage, coolDown, message)
  })
}

Documentation

You can find more examples and functions. For more information visit our wiki.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Acknowledgements

See also

  • C# version of dlivetv-unofficial-api

Current Tags

  • 2.2.0                                ...           latest (a year ago)

19 Versions

  • 2.2.0                                ...           a year ago
  • 2.1.19                                ...           a year ago
  • 2.1.18                                ...           a year ago
  • 2.1.16                                ...           a year ago
  • 2.1.15                                ...           a year ago
  • 2.1.14                                ...           a year ago
  • 2.1.13                                ...           a year ago
  • 2.1.12                                ...           a year ago
  • 2.1.11                                ...           a year ago
  • 2.1.10                                ...           a year ago
  • 2.0.10                                ...           a year ago
  • 2.0.9                                ...           a year ago
  • 2.0.8                                ...           a year ago
  • 2.0.7                                ...           a year ago
  • 2.0.6                                ...           a year ago
  • 2.0.5                                ...           a year ago
  • 2.0.4                                ...           a year ago
  • 2.0.3                                ...           a year ago
  • 2.0.2                                ...           a year ago
Maintainers (2)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (1)
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |