Commit de16a5e8 authored by nanahira's avatar nanahira

use cookie everywhere

parent eb9adb1e
Pipeline #22490 passed with stages
in 38 seconds
...@@ -73,7 +73,7 @@ def getTwitterSession(useCookie): ...@@ -73,7 +73,7 @@ def getTwitterSession(useCookie):
twitter_b = OAuth2Session() twitter_b = OAuth2Session()
twitter_b.headers["Authorization"] = "Bearer {}".format(random.choice(twitterKeys)) twitter_b.headers["Authorization"] = "Bearer {}".format(random.choice(twitterKeys))
twitter_b.headers['user-agent'] = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36" twitter_b.headers['user-agent'] = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36"
if cookie and csrf and useCookie: if cookie and csrf: # and useCookie:
twitter_b.headers['cookie'] = cookie twitter_b.headers['cookie'] = cookie
twitter_b.headers['x-csrf-token'] = csrf twitter_b.headers['x-csrf-token'] = csrf
return twitter_b return twitter_b
...@@ -238,6 +238,7 @@ def searchban(screen_name): ...@@ -238,6 +238,7 @@ def searchban(screen_name):
returnjson["profile"]["suspended"] = True returnjson["profile"]["suspended"] = True
return returnjson return returnjson
else: else:
print("Profile error: " + usertl.text)
if "error" in usertl_json and usertl_json["error"] == "Not authorized.": if "error" in usertl_json and usertl_json["error"] == "Not authorized.":
returnjson["profile"]["protected"] = True returnjson["profile"]["protected"] = True
returnjson["profile"]["suspended"] = True returnjson["profile"]["suspended"] = True
...@@ -446,8 +447,8 @@ def searchban(screen_name): ...@@ -446,8 +447,8 @@ def searchban(screen_name):
except KeyError as e: except KeyError as e:
print("Errored testing {}".format(screen_name)) print("Errored testing {}".format(screen_name))
print(e) print(e)
#if replies is not None: if replies is not None:
# print("Response: " + replies.text) print("Response: " + replies.text)
returnjson["tests"]["ghost"] = {} returnjson["tests"]["ghost"] = {}
returnjson["tests"]["more_replies"] = {} returnjson["tests"]["more_replies"] = {}
hasFailure = True hasFailure = True
......
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