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