How to find popular people that you may want to follow
How to find popular people that you may want to follow
Last time I published a short post where I explained how to get a list of followers, people that you follow, followers of your followers and the list of people that are followed by the people that you follow.
Sounds complicated enough? Not quite ;-)
@kenny-crane proposed to have a small useful enhancement:
I guess a further step could be to create a list of people
who those you follow are following, and sort it by number
of times they appear in the results, so you can see who
are some popular people that you may want to follow.
You could also find out if you are already following each of these people.
I thought for a while and I decided to use a https://docs.python.org/3/library/collections.html#collections.Counter object to solve it. With just a few lines of code you can check the sets intersection
and have the result.
Here it goes:
import sys
from collections import Counter
from steemapi.steemnoderpc import SteemNodeRPC
class FollowMe(object):
def __init__(self):
self.rpc = SteemNodeRPC("wss://node.steem.ws", "", "", apis=["follow"])
def following(self, account):
return [f["following"] for f in self.rpc.get_following(account, "", "blog", 100, api="follow")]
if __name__ == "__main__":
if len(sys.argv) < 2:
sys.stderr.write("Usage: %s steem_account" % (sys.argv[0],))
sys.exit(1)
f = FollowMe()
following_counter = Counter()
for following in f.following(sys.argv[1]):
print("%s follows %s" % (following, f.following(following)))
print(60*"-")
following_counter.update(f.following(following))
print(following_counter)
print(60 * "-")
print(following_counter.most_common(10))
following = f.following(sys.argv[1])
most_common_ten = [account[0] for account in following_counter.most_common(10)]
print("%s should be following %s" % (sys.argv[1], str(set(most_common_ten))))
print("%s currently follows %s" % (sys.argv[1], str(set(following).intersection(set(most_common_ten)))))
For my account the result was
cryptomental should be following {'anwenbaumeister', 'officialfuzzy', 'roelandp', 'complexring', 'stellabelle', 'riverhead', 'pharesim', 'cass', 'ned', 'clains'}
cryptomental currently follows {'complexring'}
I also tried a few popular accounts like @dollarvigilante
dollarvigilante should be following {'dantheman', 'barrycooper', 'lukewearechange', 'sterlinluxan', 'corbettreport', 'hilarski', 'falkvinge', 'churdtzu', 'larkenrose', 'dragonanarchist'}
dollarvigilante currently follows {'lukewearechange', 'dragonanarchist', 'larkenrose', 'corbettreport', 'falkvinge', 'hilarski', 'dantheman', 'sterlinluxan'}
@dollarvigilante, if you read this you should add 'barrycooper' and 'churdtzu' to your list :D
Next time we can add another heuristics. Have fun with finding best people around!
I'm glad you thought about my proposed addition and created it so quickly!
I thought of doing it myself, as learning Python is on my To Do list. I bought an intro book and it looks easy enough to work in. I'm already familiar with other languages.
A few years ago, I made a "People You Might Like" app for a private social network, that made me think of the suggestion I put on your previous post. I used Friends of Friends, Location, Occupation and a 4th field that I don't recall offhand to present such a list of Members, for all Members on their profile page.
Something very fancy could probably be developed here, using titles and tags of posts one upvotes, to find other articles and authors one might be interested in. It could even contain some machine intelligence to learn, based on which of its suggestions were actually used, to become better over time.
Anyway, it's great that you put this together, and in such little time. Thanks!
It is great to hear that you like it. If you are familiar with other languages, Python is the way to go. You will be surprised how powerful it is. Whenever you think of adding a library or a make a C/C++ binding make sure to research beforehand as the library that you need may have already been developed.
Crypto-currencies were bringing my attention for some time now but I started diving deeper just two weeks ago when I discovered STEEM and STEEMIT. With steemit you can access a lot of information that you are not allowed to get in another social media platforms. It is indeed a great field for research and has a huge potential to have machine intelligence applied to the data.
You can run your own wallet/witness node on a local machine and have full blockchain at your service. If you can read computer languages you can even have a look and see how the whole machinery is implemented - look for Steemit https://github.com/steemit/steem and Bitshares-2: https://github.com/bitshares/bitshares-2 on GitHub.
Thanks for the info on Python and steem! I have had those sites bookmarked and downloaded the code, but haven't done too much with it yet. I did my own notification system with js code, but then others made tools with more features so I used theirs! I don't think you can Post info (like vote) with js, just Get info. I'm interested in a Posting, so I will eventually do a Python Steem project I am sure.
Thanks for this sample code. Maybe you can point me to where the source of this library is at:
from steemapi.steemnoderpc import SteemNodeRPC
It may be obvious but it's super late for me and I'm 99% sleep. :P
Yes, sure https://github.com/xeroc/python-steemlib have fun and good night ;)