Commit 0a2b143e authored by nanahira's avatar nanahira

it really was too slow

parent 7198a7e2
Pipeline #18767 passed with stage
in 27 seconds
......@@ -249,7 +249,6 @@ def searchban(screen_name):
# print(replies.text)
try:
foundTweet = False
ghostban = True
ghostTweetId = None
ghostReplyId = None
......@@ -258,15 +257,22 @@ def searchban(screen_name):
showmoreReplyId = None
repliesJson = replies.json()
maindata = repliesJson["data"]["user"]["result"]["timeline"]["timeline"]["instructions"]
checkedTweets = set()
for d in maindata:
if not ghostban:
# all checks done
break
if d["type"] == "TimelineAddEntries":
for ent in d["entries"]:
if not ghostban:
# all checks done
break
if ent["entryId"].startswith("tweet"):
tmp = ent["content"]["itemContent"]["tweet_results"]["result"]["legacy"]
if "in_reply_to_status_id_str" in tmp:
if "in_reply_to_status_id_str" in tmp and tmp["in_reply_to_status_id_str"] not in checkedTweets:
reply = tmp
tweetId = reply["in_reply_to_status_id_str"]
foundTweet = True
checkedTweets.add(tweetId)
if ghostTweetId is None:
ghostTweetId = tweetId
ghostReplyId = reply["id_str"]
......@@ -290,12 +296,12 @@ def searchban(screen_name):
continue
insts = tweetdetails.json()["data"]["threaded_conversation_with_injections"]["instructions"]
for inst in insts:
if not ghostban and showmore:
if not ghostban:
# all checks done
break
if inst["type"] == "TimelineAddEntries":
for ent in inst["entries"]:
if not ghostban and showmore:
if not ghostban:
# all checks done
break
print("Current entry of {} is: {}".format(screen_name, ent["entryId"]))
......@@ -330,7 +336,7 @@ def searchban(screen_name):
print("{} is reply deboosted because of {} => {}.".format(screen_name, tweetId, replyId))
showmore = True
break
if foundTweet:
if len(checkedTweets) > 0:
if ghostban:
print("{} is ghost banned.".format(screen_name))
returnjson["tests"]["ghost"] = {
......
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