Resteem
Resteem is defined inside a "custom_json" operation. It doesn't have a separated operation type. It's basically counterpart of "retweet", the concept you may be familiar with Twitter.
Condenser interface (Steemit) or other interfaces doesn't show that information that who resteemed your posts. Let's find out who supports our posts by resteeming.
Main Flow of the script
- Go through the account history
- Filter main post creations
- Check resteemers and add them to a counter
- Get an output with cool visualization
Since going through the history takes a lot of time, I have only analyzed my account's last 30 days. If you care to wait, you can just remove that check and get all history.
Script
from steem import Steem
from steem.account import Account
from steem.post import Post
from collections import Counter
import steembase
import pygal
def resteemers(steemd, username, output_path):
processed_posts = set()
resteemer_list = list()
resteemed_posts = list()
acc = Account(username, steemd_instance=steemd)
for comment in acc.history_reverse(filter_by=["comment"]):
# don't process updates
post_identifier = "@%s/%s" % (
comment.get("author"), comment.get("permlink"))
if post_identifier in processed_posts:
continue
processed_posts.add(post_identifier)
# don't process resteems of the author
if comment.get("author") != username:
continue
try:
post = Post(comment, steemd_instance=steemd)
except steembase.exceptions.PostDoesNotExist:
continue
if post.time_elapsed().total_seconds() > 2592000: # 1 month
break
# don't process comments
if not post.is_main_post():
continue
resteemers = steemd.get_reblogged_by(
post.get("author"), post.get("permlink"))
resteemers.remove(username)
if len(resteemers) == 0:
continue
for resteemer in resteemers:
resteemer_list.append(resteemer)
resteemed_posts.append(post.identifier)
most_resteemed_posts = Counter(resteemed_posts).most_common(5)
most_resteemers = Counter(resteemer_list).most_common(5)
line_chart = pygal.Bar()
line_chart.title = 'Most Resteemed Posts (%s)' % username
for item in most_resteemed_posts:
line_chart.add(item[0], item[1])
line_chart.render_to_file("%s/most_resteemed.svg" % output_path)
pie = pygal.Pie()
pie.title = 'Resteemers of %s' % username
for item in most_resteemers:
pie.add(item[0], item[1])
pie.render_to_file("%s/resteemers.svg" % output_path)
def main():
s = Steem(nodes=["https://api.steemit.com"])
resteemers(s, "emrebeyler", "/tmp/")
if __name__ == '__main__':
main()
See the script nicely formatted at Github Gists.
Example Outputs
1. Most resteemed posts
2. Usual resteemers
Requirements
You need to have steem-python and pygal libraries installed in your local python environment.
Have fun.