Fix remaining import paths in serp/server.py

- async_web_fetcher -> neopig.async_web_fetcher
- screenshot -> neopig.screenshot

These were missed during the module reorganization, causing
/page/view and other endpoints to fail with import errors.
This commit is contained in:
Russell Ballestrini 2026-01-06 15:44:22 -05:00
parent 6193ce2724
commit d91c0592ca

View file

@ -341,7 +341,7 @@ async def view_media_page(request: Request, md5_hash: str, noai: bool = Query(Fa
# Fallback for imgur and other CDNs - lookup by filename/ID
# Only apply to URLs that look like media files (have media extension)
from async_web_fetcher import IMAGE_EXTENSIONS, VIDEO_EXTENSIONS, AUDIO_EXTENSIONS
from neopig.async_web_fetcher import IMAGE_EXTENSIONS, VIDEO_EXTENSIONS, AUDIO_EXTENSIONS
from pathlib import Path as P
media_exts = IMAGE_EXTENSIONS | VIDEO_EXTENSIONS | AUDIO_EXTENSIONS
for orig, res in resolved.items():
@ -532,7 +532,7 @@ async def view_page(request: Request,
# Fallback for imgur and other CDNs - lookup by filename/ID
# Only apply to URLs that look like media files (have media extension)
from async_web_fetcher import IMAGE_EXTENSIONS, VIDEO_EXTENSIONS, AUDIO_EXTENSIONS
from neopig.async_web_fetcher import IMAGE_EXTENSIONS, VIDEO_EXTENSIONS, AUDIO_EXTENSIONS
from pathlib import Path as P
media_exts = IMAGE_EXTENSIONS | VIDEO_EXTENSIONS | AUDIO_EXTENSIONS
for murl in [u for u in resolved.values() if u not in url_to_hash]:
@ -1651,8 +1651,8 @@ async def resume_crawl_job(job_id: int):
async def run_crawl(jid=job_id, uri=target_uri):
try:
from neopig import NeoPig
from async_web_fetcher import CrawlMode
from screenshot import ScreenshotConfig
from neopig.async_web_fetcher import CrawlMode
from neopig.screenshot import ScreenshotConfig
screenshot_config = ScreenshotConfig(enabled=job_screenshots)
pig = NeoPig(db_path=app_config.DB_PATH, vault_path=str(app_config.VAULT_PATH), fast_mode=job_fast, screenshot_config=screenshot_config)
await pig.init()
@ -1859,7 +1859,7 @@ async def start_crawl(request: CrawlRequest, background_tasks: BackgroundTasks):
# Import neopig here to avoid circular imports
from neopig import NeoPig
from async_web_fetcher import CrawlMode
from neopig.async_web_fetcher import CrawlMode
# Map mode string to enum
mode_map = {
@ -1899,7 +1899,7 @@ async def start_crawl(request: CrawlRequest, background_tasks: BackgroundTasks):
async def run_crawl(jid=job_id, uri=target_uri, fresh=is_fresh, fast=is_fast, screenshots=has_screenshots, hydra=is_hydra, depth=crawl_depth, keywords=crawl_keywords, max_pages=crawl_max_pages):
try:
from screenshot import ScreenshotConfig
from neopig.screenshot import ScreenshotConfig
screenshot_config = ScreenshotConfig(enabled=screenshots)
pig = NeoPig(db_path=app_config.DB_PATH, vault_path=str(app_config.VAULT_PATH), fast_mode=fast, screenshot_config=screenshot_config)
await pig.init()