Commit e3ec854d authored by nanahira's avatar nanahira

updated log and some logics

parent 6c5ea85e
Pipeline #9128 passed with stage
in 8 seconds
......@@ -23,6 +23,7 @@ def shadowban(screen_name):
@app.route("/<screen_name>")
def searchban(screen_name):
print("Checking {}".format(screen_name))
returnjson = {
"timestamp": time.time(),
"profile": {
......@@ -169,7 +170,7 @@ def searchban(screen_name):
reply = None
print(user_id)
print("User ID of {}: {}".format(screen_name, user_id))
get_reply_vars = { "count": 700, "userId": user_id,
"includePromotedContent": False, "withSuperFollowsUserFields": False, "withBirdwatchPivots": False,
......@@ -215,7 +216,7 @@ def searchban(screen_name):
if inst["type"] == "TimelineAddEntries":
for ent in inst["entries"]:
print(ent["entryId"])
print("Current entry of {} is: {}".format(screen_name, ent["entryId"]))
if ent["entryId"].startswith("conversationthread"):
ghostban = True
for item in ent["content"]["items"]:
......@@ -226,11 +227,11 @@ def searchban(screen_name):
ghostban = False
break
if ghostban:
print("Hello")
print("{} is ghost banned.".format(screen_name))
returnjson["tests"]["ghost"] = {"ban": True}
if ent["entryId"].startswith("cursor-bottom"):
print("hi")
print("{}'s test touched bottom.".format(screen_name))
returnjson["tests"]["ghost"] = {}
returnjson["tests"]["more_replies"] = {}
break
......@@ -250,15 +251,17 @@ def searchban(screen_name):
for c_ent in c_i["entries"]:
if c_ent["entryId"].startswith("conversationthread"):
more = True
print("more")
print("Checking more contents of {}".format(screen_name))
for c_item in c_ent["content"]["items"]:
if c_item["item"]["itemContent"]["tweet_results"]["result"]["legacy"]["user_id_str"] == user_id:
returnjson["tests"]["ghost"] = {"ban": False}
returnjson["tests"]["more_replies"] = {"ban": True, "tweet":reply["id_str"], "in_reply_to": c_item["item"]["itemContent"]["tweet_results"]["result"]["legacy"]["id_str"]}
print("{} is reply deboosted.".format(screen_name))
more = False
break
if more:
print("{} is both ghost banned and reply deboosted.".format(screen_name))
returnjson["tests"]["ghost"] = {"ban": True}
returnjson["tests"]["more_replies"] = {"ban": True}
if not showmore:
......@@ -273,12 +276,13 @@ def searchban(screen_name):
returnjson["tests"]["more_replies"] = {}
print("ban" in returnjson["tests"]["more_replies"])
print("ban" in returnjson["tests"]["ghost"])
print(returnjson["tests"]["ghost"])
#print("ban" in returnjson["tests"]["more_replies"])
#print("ban" in returnjson["tests"]["ghost"])
#print(returnjson["tests"]["ghost"])
if "ban" not in returnjson["tests"]["more_replies"] and "ban" in returnjson["tests"]["ghost"] and returnjson["tests"]["ghost"]["ban"] == False:
returnjson["tests"]["more_replies"] == {"ban": False}
returnjson["tests"]["more_replies"] = {"ban": False}
print("Result of {}: {}".format(screen_name, json.dumps(returnjson)))
return returnjson
if __name__ == '__main__':
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment