|
|
|
@ -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
|