Commit c92379b7 authored by nanahira's avatar nanahira

tmp bad

parent 0a2b143e
Pipeline #19457 passed with stage
in 26 seconds
......@@ -45,6 +45,7 @@ FeaturesDict = {
"responsive_web_twitter_blue_verified_badge_is_enabled": False,
"view_counts_public_visibility_enabled": False,
"view_counts_everywhere_api_enabled": False,
"longform_notetweets_consumption_enabled": False,
}
FeaturesJson = json.dumps(FeaturesDict)
......@@ -57,16 +58,18 @@ def getTwitterSession():
return twitter_b
def doSearch(screen_name, twitter_b):
global isHealthy
searchurl_v2 = "https://api.twitter.com/2/search/adaptive.json"
params_v2 = {"q": "from:@{}".format(screen_name), "count": 1, "spelling_corrections": 0, "tweet_search_mode": "live"}
search_v2 = twitter_b.get(searchurl_v2, params=params_v2).json()
isHealthy = 'globalObjects' in search_v2
if isHealthy:
return search_v2["globalObjects"]["tweets"]
else:
print("Rate limit occurred, marking as unavailable.")
return None
return None
#global isHealthy
#searchurl_v2 = "https://api.twitter.com/2/search/adaptive.json"
#params_v2 = {"q": "from:@{}".format(screen_name), "count": 1, "spelling_corrections": 0, "tweet_search_mode": "live"}
#response = twitter_b.get(searchurl_v2, params=params_v2)
#search_v2 = response.json()
#isHealthy = 'globalObjects' in search_v2
#if isHealthy:
# return search_v2["globalObjects"]["tweets"]
#else:
# print("Search error: " + response.text)
# return None
@app.route('/_healthy')
def healthy():
......@@ -246,8 +249,7 @@ def searchban(screen_name):
}
get_reply_param = param = {"variables": json.dumps(get_reply_vars), "features": FeaturesJson}
replies = twitter_b.get("https://twitter.com/i/api/graphql/{}/{}".format(ENDPOINT["UserTweetsAndReplies"], "UserTweetsAndReplies"), params=get_reply_param)
# print(replies.text)
try:
ghostban = True
ghostTweetId = None
......@@ -372,7 +374,8 @@ def searchban(screen_name):
returnjson["tests"]["more_replies"] = {}
except KeyError as e:
print("Errored testing {}".format(screen_name))
print(e)
print(e)
print("Response: " + replies.text)
returnjson["tests"]["ghost"] = {}
returnjson["tests"]["more_replies"] = {}
......
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