|  |  |  | @ -1,8 +1,10 @@ | 
			
		
	
		
			
				
					|  |  |  |  | import json | 
			
		
	
		
			
				
					|  |  |  |  | import os | 
			
		
	
		
			
				
					|  |  |  |  | import traceback | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | import httpx | 
			
		
	
		
			
				
					|  |  |  |  | from loguru import logger | 
			
		
	
		
			
				
					|  |  |  |  | from retry import retry | 
			
		
	
		
			
				
					|  |  |  |  | from selenium import webdriver | 
			
		
	
		
			
				
					|  |  |  |  | from selenium.webdriver.common.by import By | 
			
		
	
		
			
				
					|  |  |  |  | from selenium.webdriver.support import expected_conditions as ec | 
			
		
	
	
		
			
				
					|  |  |  | @ -53,7 +55,7 @@ def login(): | 
			
		
	
		
			
				
					|  |  |  |  |         WebDriverWait(driver, 30).until( | 
			
		
	
		
			
				
					|  |  |  |  |             ec.presence_of_element_located((By.CSS_SELECTOR, 'div[aria-label="Timeline: List"]'))) | 
			
		
	
		
			
				
					|  |  |  |  |          | 
			
		
	
		
			
				
					|  |  |  |  |         logs = driver.get_log("performance") | 
			
		
	
		
			
				
					|  |  |  |  |         logs = driver.get_log("performance")     | 
			
		
	
		
			
				
					|  |  |  |  |         #with open("log.json", "w", encoding="utf-8") as f: json.dump(logs, f, ensure_ascii=False, indent=4) | 
			
		
	
		
			
				
					|  |  |  |  |         for packet in logs: | 
			
		
	
		
			
				
					|  |  |  |  |             message = json.loads(packet["message"])["message"] | 
			
		
	
	
		
			
				
					|  |  |  | @ -75,7 +77,7 @@ def login(): | 
			
		
	
		
			
				
					|  |  |  |  |         driver.quit() | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | @retry(tries=3, delay=5) | 
			
		
	
		
			
				
					|  |  |  |  | def get_list(list_id): | 
			
		
	
		
			
				
					|  |  |  |  |     logger.info(f"Check list https://x.com/i/lists/{list_id}") | 
			
		
	
		
			
				
					|  |  |  |  |     with open("config.json", "r", encoding="utf-8") as f: | 
			
		
	
	
		
			
				
					|  |  |  | @ -96,6 +98,7 @@ def get_list(list_id): | 
			
		
	
		
			
				
					|  |  |  |  |     ) | 
			
		
	
		
			
				
					|  |  |  |  |     if resp.status_code != 200: | 
			
		
	
		
			
				
					|  |  |  |  |         logger.error(f"Error fetching list {list_id}: {resp.status_code} {resp.text}") | 
			
		
	
		
			
				
					|  |  |  |  |         os.remove("headers.json") | 
			
		
	
		
			
				
					|  |  |  |  |         return None | 
			
		
	
		
			
				
					|  |  |  |  |     logger.info(f"Checked {list_id}") | 
			
		
	
		
			
				
					|  |  |  |  |     return resp.json() | 
			
		
	
	
		
			
				
					|  |  |  | 
 |