operations | 0. | 0. | comment |
---|
1. | parent_author | skepticology |
---|
parent_permlink | live-feed-of-posts-and-comments-beginner-python-tutorial |
---|
author | skepticology |
---|
permlink | q7kdhy |
---|
title | "" |
---|
body | "This program was updated with a mute list, language filter, author reputation, and character count.
````
from steem import Steem
from steem.blockchain import Blockchain
from steem.account import Account
from steem.post import Post
import math
steem = Steem(node='https://api.steemit.com')
blockchain = Blockchain()
stream = blockchain.stream(filter_by=['comment'])
mutelist = ["abusereports", "actifit", "alphaccino.art", "arcange", "bdvoter.cur", "build-it.curator", "boomerang", "cheetah", "crystalliu", "curationkiwi", "dlease", "drotto", "giphy", "innerblocks", "innerhive", "likwid", "marcocasario", "ngc", "opgaming", "patrice", "sirvotesalot", "steembots.info", "steemexplorers", "steemitboard", "steem-ua", "tipu", "thecyclist", "trendotoken", "upvotebank", "upvotefromme", "xx0xx", "xxxxxxxxxx", "whalepromobot", "z8teyb289qav9z"]
def isLanguage(postbody):
try:
postbody.encode(encoding='utf-8').decode('ascii')
except UnicodeDecodeError:
return False
else:
return True
while True:
try:
for post in stream:
postauthor = post["author"]
posttitle = post["title"]
postbody = post["body"]
permlink = post["permlink"]
postparent = post['parent_author']
postlink = "https://www.steemit.com/@" + postauthor + "/" + permlink
if postauthor not in mutelist:
if(isLanguage(postbody)):
print('\033[94m' + postlink)
if(posttitle):
if "@@" in postbody:
reputation = float(steem.get_account(postauthor)["reputation"])
rep = int((math.log10(abs(reputation))-9)*9)+25
print('\033[91m' + '(' + str(rep) + ')' + postauthor + ' edited ' + posttitle + '.\n' + '\033[0m' + postbody[0:500])
else:
reputation = float(steem.get_account(postauthor)["reputation"])
rep = int((math.log10(abs(reputation))-9)*9)+25
print('\033[92m' + '(' + str(rep) + ')' + postauthor + ' posted ' + posttitle + '.\n' + '\033[0m' + postbody[0:500])
else:
if "@@" in postbody:
reputation = float(steem.get_account(postauthor)["reputation"])
rep = int((math.log10(abs(reputation))-9)*9)+25
print('\033[91m' + '(' + str(rep) + ')' + postauthor + ' edited comment to ' + postparent + '.\n' + '\033[0m' + postbody[0:500])
else:
reputation = float(steem.get_account(postauthor)["reputation"])
rep = int((math.log10(abs(reputation))-9)*9)+25
print('\033[93m' + '(' + str(rep) + ')' + postauthor + ' replied to ' + postparent + '.\n' + '\033[0m' + postbody[0:500])
print('--------------------------------------------------------------')
except Exception as error:
print(repr(error))
````" |
---|
json_metadata | {"tags":["steem"],"app":"steempeak/2020.05.1"} |
---|
|
---|
|
---|
|
---|