Commit 4a329d55 authored by nanahira's avatar nanahira

fix search empty

parent 3c779626
Pipeline #36707 passed with stages
in 1 minute and 24 seconds
......@@ -127,8 +127,13 @@ def doSearch(screen_name):
}
response = twitter_b.get(searchurl_v2, params=params_v2)
#print("Search: " + response.text)
search_v2 = response.json()
search_v2 = {}
try:
search_v2 = response.json()
except Exception as e:
print("Search Error parsing JSON: " + str(e))
print("Response: " + response.text)
return None
isHealthy = 'data' in search_v2
if isHealthy:
return search_v2["data"]["search_by_raw_query"]["search_timeline"]["timeline"]["instructions"]
......@@ -408,7 +413,9 @@ def searchban(screen_name):
## get replies
## Start GraphQL
guest_session = twitter_b.post("https://api.twitter.com/1.1/guest/activate.json")
guest_session = twitter_b.post("https://api.x.com/1.1/guest/activate.json")
print("Guest session: " + guest_session.text)
twitter_b.headers["x-guest-token"] = guest_session.json()["guest_token"]
......@@ -435,6 +442,7 @@ def searchban(screen_name):
showmore = False
showmoreTweetId = None
showmoreReplyId = None
print("Replies text: " + replies.text)
repliesJson = replies.json()
maindata = repliesJson["data"]["user"]["result"]["timeline"]["timeline"]["instructions"]
checkedTweets = set()
......
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