|
|
|
@ -150,7 +150,10 @@ def parse_entities(entity):
|
|
|
|
|
def parse_card(card):
|
|
|
|
|
data = {}
|
|
|
|
|
for v in card["legacy"]["binding_values"]:
|
|
|
|
|
if "choice" in v["key"] or v["key"] in ["end_datetime_utc", "unified_card"]:
|
|
|
|
|
if "choice" in v["key"] or v["key"] in [
|
|
|
|
|
"end_datetime_utc",
|
|
|
|
|
"unified_card",
|
|
|
|
|
"summary_photo_image_original"]:
|
|
|
|
|
value_name = f"{v['value']['type'].lower()}_value"
|
|
|
|
|
data[v["key"]] = v['value'].get(value_name, "")
|
|
|
|
|
|
|
|
|
@ -169,6 +172,13 @@ def parse_card(card):
|
|
|
|
|
except:
|
|
|
|
|
logger.error(f"error parsing unified_card {card_data}")
|
|
|
|
|
|
|
|
|
|
if "summary_photo_image_original" in data:
|
|
|
|
|
photo = {
|
|
|
|
|
"url": data["summary_photo_image_original"]["url"],
|
|
|
|
|
"video": ""
|
|
|
|
|
}
|
|
|
|
|
del data["summary_photo_image_original"]
|
|
|
|
|
|
|
|
|
|
return data, photo
|
|
|
|
|
|
|
|
|
|
def parse_tweet(tweet):
|
|
|
|
@ -277,7 +287,8 @@ def main(config):
|
|
|
|
|
if json_data:
|
|
|
|
|
pprint(json_data)
|
|
|
|
|
try:
|
|
|
|
|
resp = requests.post(config["callback_url"], json=json_data)
|
|
|
|
|
resp = requests.post(config["callback_url"],
|
|
|
|
|
json=json_data, timeout=10)
|
|
|
|
|
logger.info(resp.content)
|
|
|
|
|
except Exception as e:
|
|
|
|
|
logger.error(str(e))
|
|
|
|
|