steem-js icon indicating copy to clipboard operation
steem-js copied to clipboard

How to get information from Object

Open carolabianchi opened this issue 7 years ago • 2 comments

Hi everybody! I write you because I need to understand how can I get information from the object associated to a post.

The code is:

const author = "pippofranco"; const permlink = "il-segreto-per-il-successo"; steem.api.getContent(author, permlink, function(err, result) { console.log(result); });

The object related to the user is:

schermata 2018-10-18 alle 16 05 58

How can I extract the information about "category"?

I need your help for my degree...

Thank you in advance!!!!

carolabianchi avatar Oct 18 '18 14:10 carolabianchi

console.log(result.category);

Jolly-Pirate avatar Oct 18 '18 17:10 Jolly-Pirate

Thank you Jolly-Pirate!

If I need to extract the category of multiple posts as in the next lines of code, how can I proceed? The code is:

for (var i = 0, len = vm.following.length; i < len; i++) { steem.api.getDiscussionsByBlog({tag: vm.following[i].name, limit: 50}, function(err, result) { if (result) { console.log(result); let postContainer = $('#result'); let metadato = JSON.parse(result[i].json_metadata); postContainer.append( /* params */); console.log(result[i].category); } }) }

The idea is to retrieve 50 posts of each user in the variable vm.following and for these posts I need to extract the category related to. How can I do this? Any advice?

carolabianchi avatar Oct 19 '18 14:10 carolabianchi