Commit 62c743f2 authored by nanahira's avatar nanahira

fix ghost and reply deboost

parent 5462d3a9
Pipeline #12428 passed with stage
in 15 seconds
......@@ -216,7 +216,6 @@ def searchban(screen_name):
insts = tweetdetails.json()["data"]["threaded_conversation_with_injections"]["instructions"]
showmore = False
for inst in insts:
if inst["type"] == "TimelineAddEntries":
......@@ -224,17 +223,19 @@ def searchban(screen_name):
print("Current entry of {} is: {}".format(screen_name, ent["entryId"]))
if ent["entryId"].startswith("conversationthread"):
ghostban = True
inReplyTo = "-1"
for item in ent["content"]["items"]:
if "tweet_results" in item["item"]["itemContent"] and item["item"]["itemContent"]["tweet_results"]["result"]["legacy"]["user_id_str"] == user_id:
returnjson["tests"]["ghost"] = {"ban": False}
ghostban = False
break
if "tweet_results" in item["item"]["itemContent"]:
if item["item"]["itemContent"]["tweet_results"]["result"]["legacy"]["user_id_str"] == user_id:
returnjson["tests"]["ghost"] = {"ban": False, "in_reply_to": item["item"]["itemContent"]["tweet_results"]["result"]["legacy"]["id_str"]}
ghostban = False
break
else:
inReplyTo = item["item"]["itemContent"]["tweet_results"]["result"]["legacy"]["id_str"]
if ghostban:
print("{} is ghost banned.".format(screen_name))
returnjson["tests"]["ghost"] = {"ban": True}
returnjson["tests"]["ghost"] = {"ban": True, "in_reply_to": item["item"]["itemContent"]["tweet_results"]["result"]["legacy"]["id_str"]}
if ent["entryId"].startswith("cursor-bottom"):
print("{}'s test touched bottom.".format(screen_name))
#returnjson["tests"]["ghost"] = {}
......@@ -255,26 +256,29 @@ def searchban(screen_name):
break
for c_ent in c_i["entries"]:
if c_ent["entryId"].startswith("conversationthread"):
more = True
# more = True
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"]}
inReplyTo = c_item["item"]["itemContent"]["tweet_results"]["result"]["legacy"]["id_str"]
# returnjson["tests"]["ghost"] = {"ban": False, "in_reply_to": inReplyTo}
returnjson["tests"]["more_replies"] = {"ban": True, "in_reply_to": inReplyTo}
print("{} is reply deboosted.".format(screen_name))
more = False
# 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 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:
returnjson["tests"]["more_replies"] = {
"ban": False,
"in_reply_to": "-1",
"tweet": "-1"
}
replyTweet = reply["id_str"]
for testField in ["ghost", "more_replies"]:
if testField in returnjson["tests"]:
returnjson["tests"][testField]["tweet"] = replyTweet
except KeyError as e:
print("Errored testing {}".format(screen_name))
print(Exception.with_traceback(e))
......
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