|
|
@ -987,7 +987,7 @@ class TwitterAPI():
|
|
|
|
endpoint = "/1.1/guest/activate.json"
|
|
|
|
endpoint = "/1.1/guest/activate.json"
|
|
|
|
return str(self._call(endpoint, None, root, "POST")["guest_token"])
|
|
|
|
return str(self._call(endpoint, None, root, "POST")["guest_token"])
|
|
|
|
|
|
|
|
|
|
|
|
def _call(self, endpoint, params, root=None, method="GET"):
|
|
|
|
def _call(self, endpoint, params, root=None, method="GET", warning=True):
|
|
|
|
if root is None:
|
|
|
|
if root is None:
|
|
|
|
root = self.root
|
|
|
|
root = self.root
|
|
|
|
|
|
|
|
|
|
|
@ -1012,6 +1012,8 @@ class TwitterAPI():
|
|
|
|
|
|
|
|
|
|
|
|
if response.status_code < 400:
|
|
|
|
if response.status_code < 400:
|
|
|
|
# success
|
|
|
|
# success
|
|
|
|
|
|
|
|
if errors and warning:
|
|
|
|
|
|
|
|
self.extractor.log.warning(errors)
|
|
|
|
return data
|
|
|
|
return data
|
|
|
|
|
|
|
|
|
|
|
|
if response.status_code == 429:
|
|
|
|
if response.status_code == 429:
|
|
|
@ -1135,13 +1137,16 @@ class TwitterAPI():
|
|
|
|
params = {"variables": json.dumps(variables)}
|
|
|
|
params = {"variables": json.dumps(variables)}
|
|
|
|
data = self._call(endpoint, params)["data"]
|
|
|
|
data = self._call(endpoint, params)["data"]
|
|
|
|
|
|
|
|
|
|
|
|
if path is None:
|
|
|
|
try:
|
|
|
|
instructions = (data["user"]["result"]["timeline"]
|
|
|
|
if path is None:
|
|
|
|
["timeline"]["instructions"])
|
|
|
|
instructions = (data["user"]["result"]["timeline"]
|
|
|
|
else:
|
|
|
|
["timeline"]["instructions"])
|
|
|
|
for key in path:
|
|
|
|
else:
|
|
|
|
data = data[key]
|
|
|
|
for key in path:
|
|
|
|
instructions = data["instructions"]
|
|
|
|
data = data[key]
|
|
|
|
|
|
|
|
instructions = data["instructions"]
|
|
|
|
|
|
|
|
except KeyError:
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|
if pinned_tweet:
|
|
|
|
if pinned_tweet:
|
|
|
|
pinned_tweet = False
|
|
|
|
pinned_tweet = False
|
|
|
@ -1214,13 +1219,16 @@ class TwitterAPI():
|
|
|
|
params = {"variables": json.dumps(variables)}
|
|
|
|
params = {"variables": json.dumps(variables)}
|
|
|
|
data = self._call(endpoint, params)["data"]
|
|
|
|
data = self._call(endpoint, params)["data"]
|
|
|
|
|
|
|
|
|
|
|
|
if path is None:
|
|
|
|
try:
|
|
|
|
instructions = (data["user"]["result"]["timeline"]
|
|
|
|
if path is None:
|
|
|
|
["timeline"]["instructions"])
|
|
|
|
instructions = (data["user"]["result"]["timeline"]
|
|
|
|
else:
|
|
|
|
["timeline"]["instructions"])
|
|
|
|
for key in path:
|
|
|
|
else:
|
|
|
|
data = data[key]
|
|
|
|
for key in path:
|
|
|
|
instructions = data["instructions"]
|
|
|
|
data = data[key]
|
|
|
|
|
|
|
|
instructions = data["instructions"]
|
|
|
|
|
|
|
|
except KeyError:
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|
for instr in instructions:
|
|
|
|
for instr in instructions:
|
|
|
|
if instr["type"] == "TimelineAddEntries":
|
|
|
|
if instr["type"] == "TimelineAddEntries":
|
|
|
|