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

Method acache_url

crawl4ai/async_database.py:67–86  ·  view source on GitHub ↗
(self, url: str, html: str, cleaned_html: str, markdown: str, extracted_content: str, success: bool, media: str = "{}", links: str = "{}", metadata: str = "{}", screenshot: str = "")

Source from the content-addressed store, hash-verified

65 return None
66
67 async def acache_url(self, url: str, html: str, cleaned_html: str, markdown: str, extracted_content: str, success: bool, media: str = "{}", links: str = "{}", metadata: str = "{}", screenshot: str = ""):
68 try:
69 async with aiosqlite.connect(self.db_path) as db:
70 await db.execute('''
71 INSERT INTO crawled_data (url, html, cleaned_html, markdown, extracted_content, success, media, links, metadata, screenshot)
72 VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
73 ON CONFLICT(url) DO UPDATE SET
74 html = excluded.html,
75 cleaned_html = excluded.cleaned_html,
76 markdown = excluded.markdown,
77 extracted_content = excluded.extracted_content,
78 success = excluded.success,
79 media = excluded.media,
80 links = excluded.links,
81 metadata = excluded.metadata,
82 screenshot = excluded.screenshot
83 ''', (url, html, cleaned_html, markdown, extracted_content, success, media, links, metadata, screenshot))
84 await db.commit()
85 except Exception as e:
86 print(f"Error caching URL: {e}")
87
88 async def aget_total_count(self) -> int:
89 try:

Callers 1

aprocess_htmlMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected