How to Find Post Promotions Paid by a Third Party in RubysteemCreated with Sketch.

in #radiator8 years ago (edited)

Most promoted posts are promoted by the author. But wouldn't it be interesting to get a list of posts that are promoted by someone other than the author? This is how to find them.

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 other_promotion.rb containing:

require 'rubygems'
require 'bundler/setup'

Bundler.require

api = Radiator::Api.new
limit = ARGV.last || 100
limit = limit.to_i

response = api.get_account_history('null', -limit, limit)
history = response.result

history.each do |entry|
  op = entry.last.op.last
  from = op.from
  memo = op.memo
  amount = op.amount
  next if memo.nil? || memo.empty?
  next if memo.include? from

  slug = memo.split('@').last
  puts "https://steemit.com/tag/@#{slug} (promoted by: @#{from}, amount: #{amount})"
end

Then run it:

$ ruby other_promotion.rb 100

Note, the argument of 100 is the number of transactions to search, not the final number of outputs. The expected output will be something like this:

https://steemit.com/tag/@luzcypher/rabbits-for-gardeners-and-homesteaders-the-many-benefits-of-raising-a-rabbit-herd (promoted by: @greencycles, amount: 0.008 SBD)
https://steemit.com/tag/@customnature/daily-nature-fix-lush-waterfall-oasis-of-death-valley-original-photos (promoted by: @kommienezuspadt, amount: 13.000 SBD)
https://steemit.com/tag/@exploretraveler/exploring-the-napa-valley (promoted by: @vetvso, amount: 0.015 SBD)
https://steemit.com/tag/@r0achtheunsavory/the-r0ach-report-vol-4-prepping-for-the-end-of-the-world (promoted by: @smooth, amount: 2.000 SBD)
https://steemit.com/tag/@vitaly-lvov/crowdsales-monitor-august-2016 (promoted by: @hipster, amount: 10.000 SBD)
https://steemit.com/tag/@vitaly-lvov/crowdsales-monitor-august-2016 (promoted by: @hipster, amount: 5.000 SBD)
https://steemit.com/tag/@zahar/15-meter-space-whale-made-of-steel-and-colored-glass (promoted by: @dmilash, amount: 0.200 SBD)
https://steemit.com/tag/@vitaly-lvov/crowdsales-monitor-august-2016 (promoted by: @hipster, amount: 7.000 SBD)
https://steemit.com/tag/@funnyman/first-steemit-meetup-in-india-the-worlds-second-biggest-market (promoted by: @kus-knee, amount: 1.000 SBD)
https://steemit.com/tag/@funnyman/first-steemit-meetup-in-india-the-worlds-second-biggest-market (promoted by: @kus-knee, amount: 1.000 SBD)
https://steemit.com/tag/@gonzo/silver-lining-an-original-poem (promoted by: @beginningtoend, amount: 0.500 SBD)
https://steemit.com/tag/@seraph/hi-i-m-seraph-a-guardian (promoted by: @beanz, amount: 7.000 SBD)
https://steemit.com/tag/@chaospoet/guru-meditation-error (promoted by: @dwinblood, amount: 0.010 SBD)
https://steemit.com/tag/@prufarchy/the-clowns-original (promoted by: @beginningtoend, amount: 0.500 SBD)
https://steemit.com/tag/@larkenrose/raising-human-livestock (promoted by: @matildapurse, amount: 0.906 SBD)
https://steemit.com/tag/@brindleswan/beyond-bitcoin-lies-the-land-of-graphene-beyond-graphene (promoted by: @mazi, amount: 1.000 SBD)

ruby

See my previous Ruby How To posts in: #radiator #ruby

Sort:  

How many 'secret' alt accounts will come forward now with this :P

Yep. This might be a good way to find them.

fricken descent man, i continue to be impressed with your work.