-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathindex.js
More file actions
36 lines (32 loc) · 1.1 KB
/
index.js
File metadata and controls
36 lines (32 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
const { Client, BlockchainMode } = require('dsteem');
const express = require('express')
const app = express()
const port = process.env.PORT || 4000
var client = new Client('https://api.steemit.com')
app.listen(port, () => console.log(`Listening on ${port}`));
var stream = client.blockchain.getBlockStream({mode: BlockchainMode.Latest})
stream.on("data", function (block) {
try {
var object = JSON.stringify(block.transactions)
object.replace("\\", "")
object = JSON.parse(object)
} catch (error) {
console.log(error)
}
for (i = 0; i < object.length; i++) {
var json = object[i].operations[0][1]
try {
json.json_metadata = JSON.parse(json.json_metadata)
}
catch (error) {
console.log(error)
}
if (json.json_metadata.app.includes('fundition')) {
console.log('its a fundition content from ' + json.author)
//DO SOMETHING
}
})
.on('end', function () {
// done
console.log('END');
});