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): ...@@ -23,6 +23,7 @@ def shadowban(screen_name):
@app.route("/<screen_name>") @app.route("/<screen_name>")
def searchban(screen_name): def searchban(screen_name):
print("Checking {}".format(screen_name))
returnjson = { returnjson = {
"timestamp": time.time(), "timestamp": time.time(),
"profile": { "profile": {
...@@ -169,7 +170,7 @@ def searchban(screen_name): ...@@ -169,7 +170,7 @@ def searchban(screen_name):
reply = None reply = None
print(user_id) print("User ID of {}: {}".format(screen_name, user_id))
get_reply_vars = { "count": 700, "userId": user_id, get_reply_vars = { "count": 700, "userId": user_id,
"includePromotedContent": False, "withSuperFollowsUserFields": False, "withBirdwatchPivots": False, "includePromotedContent": False, "withSuperFollowsUserFields": False, "withBirdwatchPivots": False,
...@@ -215,7 +216,7 @@ def searchban(screen_name): ...@@ -215,7 +216,7 @@ def searchban(screen_name):
if inst["type"] == "TimelineAddEntries": if inst["type"] == "TimelineAddEntries":
for ent in inst["entries"]: for ent in inst["entries"]:
print(ent["entryId"]) print("Current entry of {} is: {}".format(screen_name, ent["entryId"]))
if ent["entryId"].startswith("conversationthread"): if ent["entryId"].startswith("conversationthread"):
ghostban = True ghostban = True
for item in ent["content"]["items"]: for item in ent["content"]["items"]:
...@@ -226,11 +227,11 @@ def searchban(screen_name): ...@@ -226,11 +227,11 @@ def searchban(screen_name):
ghostban = False ghostban = False
break break
if ghostban: if ghostban:
print("Hello") print("{} is ghost banned.".format(screen_name))
returnjson["tests"]["ghost"] = {"ban": True} returnjson["tests"]["ghost"] = {"ban": True}
if ent["entryId"].startswith("cursor-bottom"): if ent["entryId"].startswith("cursor-bottom"):
print("hi") print("{}'s test touched bottom.".format(screen_name))
returnjson["tests"]["ghost"] = {} returnjson["tests"]["ghost"] = {}
returnjson["tests"]["more_replies"] = {} returnjson["tests"]["more_replies"] = {}
break break
...@@ -250,15 +251,17 @@ def searchban(screen_name): ...@@ -250,15 +251,17 @@ def searchban(screen_name):
for c_ent in c_i["entries"]: for c_ent in c_i["entries"]:
if c_ent["entryId"].startswith("conversationthread"): if c_ent["entryId"].startswith("conversationthread"):
more = True more = True
print("more") print("Checking more contents of {}".format(screen_name))
for c_item in c_ent["content"]["items"]: for c_item in c_ent["content"]["items"]:
if c_item["item"]["itemContent"]["tweet_results"]["result"]["legacy"]["user_id_str"] == user_id: if c_item["item"]["itemContent"]["tweet_results"]["result"]["legacy"]["user_id_str"] == user_id:
returnjson["tests"]["ghost"] = {"ban": False} 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"]} 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 more = False
break break
if more: if more:
print("{} is both ghost banned and reply deboosted.".format(screen_name))
returnjson["tests"]["ghost"] = {"ban": True} returnjson["tests"]["ghost"] = {"ban": True}
returnjson["tests"]["more_replies"] = {"ban": True} returnjson["tests"]["more_replies"] = {"ban": True}
if not showmore: if not showmore:
...@@ -273,12 +276,13 @@ def searchban(screen_name): ...@@ -273,12 +276,13 @@ def searchban(screen_name):
returnjson["tests"]["more_replies"] = {} returnjson["tests"]["more_replies"] = {}
print("ban" in returnjson["tests"]["more_replies"]) #print("ban" in returnjson["tests"]["more_replies"])
print("ban" in returnjson["tests"]["ghost"]) #print("ban" in returnjson["tests"]["ghost"])
print(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: 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 return returnjson
if __name__ == '__main__': 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