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.
- Access token is required to use this module. Create an account on dlive.tv then follow our wiki tutorial to get your token
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
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)
})
}
You can find more examples and functions. For more information visit our wiki.
We use SemVer for versioning. For the versions available, see the tags on this repository.
- Some graphql queries were taken from dlive-go-client written by @Dak425
- Contributors
- C# version of dlivetv-unofficial-api
MIT modified License
Copyright (c) 2019 Nils Kleinert
Permission is hereby granted, free of charge, to any person who receives a copy of the Software and related documentation (the "Software") to use it without limitation, including without limitation the right to use, copy, modify, merge it. Persons to whom this Software is granted the right to grant such rights are subject to the following terms and conditions:
The above copyright notice and this permission notice must be included in all copies or partial copies of the Software.
—
THE SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT OR NON-INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER CLAIMS, WHETHER IN CONTRACT, TORT OR OTHERWISE, ARISING OUT OF OR IN CONNECTION WITH THE SOFTWARE OR ANY OTHER USE OF THE SOFTWARE.
—
It is not allowed to create and/or redistribute a new product/project with the source code of this software whose purpose is to provide the same functionality as this software.