If you want to see posts for accounts you're following, you can just use the Home (/feed
) link on steemit.com. But what if you want to see all posts and comments for accounts who follow you? This is how to create a follower feed.
As always, we use Radiator with bundler
. You can get bundler
with this command:
$ gem install bundler
I've tested it on various versions of ruby. The oldest one I got it to work was:
ruby 2.0.0p645 (2015-04-13 revision 50299) [x86_64-darwin14.4.0]
First, make a project folder:
$ mkdir radiator
$ cd radiator
Create a file named Gemfile
containing:
source 'https://rubygems.org'
gem 'radiator', github: 'inertia186/radiator'
Then run the command:
$ bundle install
Create a file named follower_latest_posts.rb
containing:
require 'rubygems'
require 'bundler/setup'
Bundler.require
puts "Usage: ruby #{__FILE__} [max_hours]" and return if ARGV.empty?
api = Radiator::FollowApi.new
followers = []
count = -1
account, max_hours = ARGV
max_hours ||= 0.25
until count == followers.size
count = followers.size
response = api.get_followers(account, followers.last, 'blog', 100)
followers += response.result.map(&:follower)
followers = followers.uniq
sleep 1
end
api = Radiator::Api.new
response = api.get_accounts(followers)
followers = response.result.sort_by do |follower|
follower.last_post
end.reverse
followers.each do |follower|
seconds = Time.now - Time.parse(follower.last_post + " UTC")
exit if seconds > max_hours.to_f * 3600
minutes = "%.1f" % (seconds / 60)
puts "https://steemit.com/@#{follower.name}/posts (#{minutes} minutes ago)"
end
Then run it:
$ ruby follower_latest_posts.rb ned
You can optionally create a bash
script to automatically refresh the results every 15 seconds. Create a file named follower_feed.sh
:
#!/bin/bash
while :
do
output="`ruby follower_latest_posts.rb $@`"
clear
echo "$output"
sleep 15
done
Then run it:
$ chmod +x follower_feed.sh
$ ./follower_feed.sh ned
The output will be something like this:
https://steemit.com/@steevc/posts (0.5 minutes ago)
https://steemit.com/@michelle.gent/posts (0.6 minutes ago)
https://steemit.com/@maarnio/posts (0.7 minutes ago)
https://steemit.com/@chadcrypto/posts (0.8 minutes ago)
https://steemit.com/@stellabelle/posts (1.0 minutes ago)
https://steemit.com/@daveks/posts (2.1 minutes ago)
https://steemit.com/@ltm/posts (2.2 minutes ago)
https://steemit.com/@mammasitta/posts (2.4 minutes ago)
https://steemit.com/@aggroed/posts (2.8 minutes ago)
https://steemit.com/@lifeworship/posts (2.9 minutes ago)
https://steemit.com/@kevinwong/posts (3.2 minutes ago)
https://steemit.com/@sharker/posts (3.4 minutes ago)
https://steemit.com/@stephenkendal/posts (4.0 minutes ago)
https://steemit.com/@villainblack/posts (4.9 minutes ago)
https://steemit.com/@papa-pepper/posts (5.6 minutes ago)
https://steemit.com/@runridefly/posts (6.1 minutes ago)
https://steemit.com/@doitvoluntarily/posts (6.3 minutes ago)
https://steemit.com/@gringalicious/posts (8.1 minutes ago)
https://steemit.com/@rossenpavlov/posts (9.5 minutes ago)
https://steemit.com/@ausbitbank/posts (9.6 minutes ago)
https://steemit.com/@funnyman/posts (10.4 minutes ago)
https://steemit.com/@moon32walker/posts (11.1 minutes ago)
https://steemit.com/@argsolver/posts (11.3 minutes ago)
https://steemit.com/@dwinblood/posts (12.7 minutes ago)
https://steemit.com/@gardenofeden/posts (13.0 minutes ago)
https://steemit.com/@james-show/posts (14.6 minutes ago)
https://steemit.com/@dajohns1420/posts (14.9 minutes ago)