MCPcopy
hub / github.com/unclecode/crawl4ai / get_cached_url

Function get_cached_url

crawl4ai/database.py:46–57  ·  view source on GitHub ↗
(url: str)

Source from the content-addressed store, hash-verified

44 raise ValueError("Database path is not set or is empty.")
45
46def 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
59def 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()

Callers 3

run_oldMethod · 0.85
runMethod · 0.85
runMethod · 0.85

Calls 2

check_db_pathFunction · 0.85
closeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…