(url: str)
| 44 | raise ValueError("Database path is not set or is empty.") |
| 45 | |
| 46 | def get_cached_url(url: str) -> Optional[Tuple[str, str, str, str, str, str, str, bool, str]]: |
| 47 | check_db_path() |
| 48 | try: |
| 49 | conn = sqlite3.connect(DB_PATH) |
| 50 | cursor = conn.cursor() |
| 51 | cursor.execute('SELECT url, html, cleaned_html, markdown, extracted_content, success, media, links, metadata, screenshot FROM crawled_data WHERE url = ?', (url,)) |
| 52 | result = cursor.fetchone() |
| 53 | conn.close() |
| 54 | return result |
| 55 | except Exception as e: |
| 56 | print(f"Error retrieving cached URL: {e}") |
| 57 | return None |
| 58 | |
| 59 | def cache_url(url: str, html: str, cleaned_html: str, markdown: str, extracted_content: str, success: bool, media : str = "{}", links : str = "{}", metadata : str = "{}", screenshot: str = ""): |
| 60 | check_db_path() |
no test coverage detected
searching dependent graphs…