fix bug: log typo

master
wlt233 2 weeks ago
parent 3484454769
commit f909dffe64

@ -79,7 +79,7 @@ def login():
@retry(tries=3, delay=5)
async def get_list(list_id):
logger.info(f"Getting list https://x.com/i/lists/{list_id}")
logger.info(f"Fetching list https://x.com/i/lists/{list_id}")
with open("./config/config.json", "r", encoding="utf-8") as f: config = json.load(f)
with open("./config/headers.json", "r", encoding="utf-8") as f: headers = json.load(f)
@ -96,17 +96,17 @@ async def get_list(list_id):
headers=headers
)
if resp.status_code != 200:
logger.error(f"Error fetching list {list_id}: {resp.status_code} {resp.text}")
logger.error(f"Error when fetching list {list_id}: {resp.status_code} {resp.text}")
os.remove("./config/headers.json")
return None
logger.info(f"Got {list_id}")
logger.info(f"Fetched {list_id}")
return resp.json()
return None
@retry(tries=3, delay=5)
async def get_detail(tweet_id):
logger.info(f"Getting tweet detail https://x.com/{{}}/status/{tweet_id}")
logger.info(f"Fetching tweet detail https://x.com/{{}}/status/{tweet_id}")
with open("./config/config.json", "r", encoding="utf-8") as f: config = json.load(f)
with open("./config/headers.json", "r", encoding="utf-8") as f: headers = json.load(f)
@ -124,9 +124,9 @@ async def get_detail(tweet_id):
headers=headers
)
if resp.status_code != 200:
logger.error(f"Error fetching tweet detail {tweet_id}: {resp.status_code} {resp.text}")
logger.error(f"Error when fetched tweet detail {tweet_id}: {resp.status_code} {resp.text}")
os.remove("./config/headers.json")
return None
logger.info(f"Got {tweet_id}")
logger.info(f"Fetched {tweet_id}")
return resp.json()
return None

@ -13,7 +13,7 @@ def parse_timeline(data):
try:
result += parse_entry(entry)
except Exception as e:
logger.error(f"error when parsing entry: {e} {e.args}")
logger.error(f"Error when parsing entry: {e} {e.args}")
logger.error(f"\n{traceback.format_exc()}")
logger.error(f"\n{pformat(entry)}")
result.sort(key=lambda x: x["timestamp"], reverse=True)
@ -47,7 +47,7 @@ def parse_content(content):
data["retweeted"] = parse_tweet(tweet["legacy"]["retweeted_status_result"]["result"])
return data
except Exception as e:
logger.error(f"error when parsing tweet: {e} {e.args}")
logger.error(f"Error when parsing tweet: {e} {e.args}")
logger.error(f"\n{traceback.format_exc()}")
logger.error(f"\n{pformat(tweet)}")
return {}
@ -96,7 +96,7 @@ def parse_card(card):
}
break
except Exception as e:
logger.error(f"error when parsing unified_card: {e} {e.args}")
logger.error(f"Error when parsing unified_card: {e} {e.args}")
logger.error(f"\n{traceback.format_exc()}")
logger.error(f"\n{pformat(card_data)}")
@ -174,7 +174,7 @@ def parse_detail(data):
try:
result += parse_entry(entry)
except Exception as e:
logger.error(f"error when parsing entry: {e} {e.args}")
logger.error(f"Error when parsing entry: {e} {e.args}")
logger.error(f"\n{traceback.format_exc()}")
logger.error(f"\n{pformat(entry)}")
result.sort(key=lambda x: x["timestamp"])

Loading…
Cancel
Save