[twitter] handle "KeyError: 'result'" for retweets (#8072)
This commit is contained in:
@@ -1870,19 +1870,16 @@ class TwitterAPI():
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
if "retweeted_status_result" in legacy:
|
if "retweeted_status_result" in legacy:
|
||||||
retweet = legacy["retweeted_status_result"]["result"]
|
try:
|
||||||
if "tweet" in retweet:
|
retweet = legacy["retweeted_status_result"]["result"]
|
||||||
retweet = retweet["tweet"]
|
if "tweet" in retweet:
|
||||||
if original_retweets:
|
retweet = retweet["tweet"]
|
||||||
try:
|
if original_retweets:
|
||||||
retweet["legacy"]["retweeted_status_id_str"] = \
|
retweet["legacy"]["retweeted_status_id_str"] = \
|
||||||
retweet["rest_id"]
|
retweet["rest_id"]
|
||||||
retweet["_retweet_id_str"] = tweet["rest_id"]
|
retweet["_retweet_id_str"] = tweet["rest_id"]
|
||||||
tweet = retweet
|
tweet = retweet
|
||||||
except KeyError:
|
else:
|
||||||
continue
|
|
||||||
else:
|
|
||||||
try:
|
|
||||||
legacy["retweeted_status_id_str"] = \
|
legacy["retweeted_status_id_str"] = \
|
||||||
retweet["rest_id"]
|
retweet["rest_id"]
|
||||||
tweet["author"] = \
|
tweet["author"] = \
|
||||||
@@ -1904,8 +1901,11 @@ class TwitterAPI():
|
|||||||
rtlegacy["withheld_scope"]
|
rtlegacy["withheld_scope"]
|
||||||
|
|
||||||
legacy["full_text"] = rtlegacy["full_text"]
|
legacy["full_text"] = rtlegacy["full_text"]
|
||||||
except KeyError:
|
except Exception as exc:
|
||||||
pass
|
extr.log.debug(
|
||||||
|
"%s: %s: %s",
|
||||||
|
tweet.get("rest_id"), exc.__class__.__name__, exc)
|
||||||
|
continue
|
||||||
|
|
||||||
yield tweet
|
yield tweet
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user