Store and prepare periscope statistics from live periscope.tv info streams.
The first step is to get some data from a periscope PUBNUB stream. The easiest way probably is to use
peristream. The following examples uses peristream
.
var peristream = require('peristream');
var periscopeStats = require('periscope-stats');
var stream = peristream('https://www.periscope.tv/w/########');
stream.connect()
.then(periscopeStats)
.then(function(bus){
bus.on(periscopeStats.UPDATE, function(stats){
console.log(stats.hearts.byUser());
// { mrrobot: 4, "bl@ck warrior_67": 3, ... }
console.log(stats.hearts.byColor());
// { orange: 12, teal: 12 }
//
console.log(stats.users.list());
// [{name: 'userName1', joinedAt: ''}, {name: 'jobBob123', ..}]
});
bus.on(periscopeStats.HEART, function(stats){
// still access to all stats, but only triggered when
// on new hearts
});
});
hearts
users
comments
list()
: ordered creation databyColor()
byUser()
fromUser(userId)
list()
: ordered creation dataforUser(userId)
byUser()
list()
: ordered creation databyColor()
fromId(id)