Hive Developer logo

Hive Developer Portal

RB: Get Post Comments

This example will output the reply details and totals for the post/comment passed as an argument to the script.

Full, runnable src of Get Post Comments can be downloaded as part of: tutorials/javascript (or download just this tutorial: devportal-master-tutorials-ruby-07_get_post_comments.zip).

Script

comments_list.rb

First, we ask the blockchain for the replies on a post or comment. Then, we grab the authors of those replies and list them, followed by the total comments count.

To Run

First, set up your workstation using the steps provided in Getting Started. Then you can create and execute the script (or clone from this repository):

git clone https://gitlab.syncad.com/hive/devportal.git
cd devportal/tutorials/ruby/07_get_post_comments
bundle install
ruby comments_list.rb https://hive.blog/communityfork/@hiveio/announcing-the-launch-of-hive-blockchain

Example Output

Replies by:
	berniesanders
	howo
	roelandp
	anomadsoul
	netuoso
	c0ff33a
	florianopolis
	davedickeyyall
	traducciones
	tsnaks
	pwny
	themarkymark
.
.
.
	hr1
	marybellrg
	victor26
	nelsonnils
	fozdru
	scholaris
	thromaspang
	a-alice
	joetunex
	awesomegames007
	jsl416
	retinox
	gringo211985
	rudyardcatling
	knowledges
	mudcat36
	dkkarolien
Total replies: 522