grantforge-api / backend /test_crawl4ai.py
GrantForge Bot
Deploy sha-9a5957fcdef15b7e2623f8b147cda6026475aee0 — source build (no GHCR)
3a3734f
Raw
History Blame Contribute Delete
727 Bytes
import asyncio
import os
import sys
from pathlib import Path
sys.path.append(str(Path(__file__).parent))
from core.crawl4ai_client import scrape_url_to_markdown
PARP_GRANTS_URL = "https://www.parp.gov.pl/component/grants/?task=grants.grant_list&type=0"
async def test_crawl4ai():
try:
markdown = await scrape_url_to_markdown(PARP_GRANTS_URL)
if not markdown:
print("EMPTY")
return
print("SUCCESS")
print(markdown[:1500])
out_path = Path(__file__).parent / "parp_crawl4ai.md"
out_path.write_text(markdown, encoding="utf-8")
print(f"Saved to {out_path}")
except Exception as e:
print("ERROR:", e)
asyncio.run(test_crawl4ai())