Last active
December 6, 2018 02:22
-
-
Save edict3d/fba4a4004c960b5549d8f38a7519ab60 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h1> Steem Curation Tracker </h1> | |
Author: | |
<input type="text" id="author" value="edicted"><br> | |
Permlink | |
<input type="text" id="permlink" | |
value="icos-and-smts-are-only-a-short-term-solution"><br> | |
<button id="track"> Track! </button><br> | |
<p id="body"> Dissect Discussion! </p> | |
<script src="https://unpkg.com/dsteem@^0.8.0/dist/dsteem.js"></script> | |
<script src="DissectDiscussion.js"></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var client = new dsteem.Client('https://api.steemit.com') | |
function getDiscussion(){ | |
/* | |
* Parse a single discussion targeted by author/permlink | |
*/ | |
var author = document.getElementById("author").value | |
var permlink = document.getElementById("permlink").value | |
var disqussionQuery = { | |
tag: author, | |
limit: 1, | |
start_author: author, | |
start_permlink: permlink | |
} | |
client.database.getDiscussions( | |
'blog', disqussionQuery).then(function(discussions){ | |
parseDiscussion(discussions) | |
}) | |
} | |
//16848339561 () | |
//00870488621 (1%) | |
//00870488621 | |
//03481954485 (3%) | |
function parseDiscussion(discussions){ | |
/* | |
* Inspect the properties of the discussion and and display in html. | |
//*/ | |
//document.body.innerHTML = ""; | |
var body = document.getElementById("body") | |
body.innerHTML = "" | |
body.innerHTML += discussions.length + "<br>" | |
for (var i = 0; i < discussions.length; i++) { | |
body.innerHTML += i + ". " | |
+ discussions[i].title + "<br>" | |
+ "Author: " + discussions[i].author + "<br>" | |
+ " REP: " + discussions[i].author_reputation + "<br>" | |
+ discussions[i].active_votes + "<br>" | |
+ discussions[i].first_reblogged_on + "<br>" | |
+ discussions[i].author_rewards + "<br>" | |
+ discussions[i].total_payout_value + "<br>" | |
+ discussions[i].curator_payout_value + "<br>" | |
+ discussions[i].percent_steem_dollars + "<br>" | |
+ discussions[i].net_votes + "<br>" | |
+ discussions[i].total_pending_payout_value + "<br>" | |
+ discussions[i].net_rshares + "<br>" | |
+ discussions[i].children_abs_rshares + "<br>" | |
+ discussions[i].abs_rshares + "<br>" | |
+ discussions[i].vote_rshares + "<br>" | |
var votes = discussions[i].active_votes | |
var j = 0 | |
for(var vote in votes) { | |
var vote = votes[j] | |
for(var propertyName in vote){ | |
body.innerHTML += '<p>' + j + " " | |
+ propertyName + " : " + vote[propertyName] | |
+ '</p>' | |
} | |
j++ | |
} | |
} | |
} | |
document.getElementById("track").onclick = getDiscussion; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="https://unpkg.com/dsteem@^0.8.0/dist/dsteem.js"></script> | |
<script> | |
var client = new dsteem.Client('https://api.steemit.com') | |
var author = "edicted" | |
var permlink = "dsteem-tutorial-part-2-hello-world" | |
var disqussionQuery = { | |
tag: author, | |
limit: 1, | |
start_author: author, | |
start_permlink: permlink | |
} | |
client.database.getDiscussions( | |
'blog', disqussionQuery).then(function(discussions){ | |
var post = discussions[0] | |
document.body.innerHTML = post.title | |
}) | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment