mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-07-10 22:32:16 +02:00
chore: bumped version to 0.0.31
This commit is contained in:
parent
8df8565e0a
commit
1c9ab207ef
56 changed files with 520 additions and 190 deletions
|
|
@ -209,7 +209,10 @@ async def _execute_async_run(
|
|||
raise
|
||||
except (SurfSenseError, HTTPException) as exc:
|
||||
await _finalize_async(
|
||||
run_id, status="error", error=str(exc), started=started,
|
||||
run_id,
|
||||
status="error",
|
||||
error=str(exc),
|
||||
started=started,
|
||||
progress=reporter.coarse,
|
||||
)
|
||||
_publish_finished(run_id, "error", error=str(exc))
|
||||
|
|
|
|||
|
|
@ -291,7 +291,9 @@ async def record_spill(
|
|||
return None
|
||||
|
||||
|
||||
async def _maybe_cleanup(session: AsyncSession, table: str, retention_days: int) -> None:
|
||||
async def _maybe_cleanup(
|
||||
session: AsyncSession, table: str, retention_days: int
|
||||
) -> None:
|
||||
"""Delete a bounded batch of expired rows on ~1% of inserts."""
|
||||
if random.random() >= _CLEANUP_SAMPLE_RATE:
|
||||
return
|
||||
|
|
|
|||
|
|
@ -30,14 +30,21 @@ def build_reviews_executor(scrape_fn: ReviewsFn | None = None) -> Executor:
|
|||
reviewsStartDate=payload.start_date,
|
||||
language=payload.language,
|
||||
)
|
||||
emit_progress("starting", "Fetching Google Maps reviews", total=payload.max_reviews, unit="review")
|
||||
emit_progress(
|
||||
"starting",
|
||||
"Fetching Google Maps reviews",
|
||||
total=payload.max_reviews,
|
||||
unit="review",
|
||||
)
|
||||
try:
|
||||
items = await scrape_fn(actor_input)
|
||||
except SignInRequiredError as exc:
|
||||
raise ForbiddenError(
|
||||
f"Google sign in required: {exc}", code="GOOGLE_SIGNIN_REQUIRED"
|
||||
) from exc
|
||||
emit_progress("done", f"Scraped {len(items)} review(s)", current=len(items), unit="review")
|
||||
emit_progress(
|
||||
"done", f"Scraped {len(items)} review(s)", current=len(items), unit="review"
|
||||
)
|
||||
return ReviewsOutput(items=items)
|
||||
|
||||
return execute
|
||||
|
|
|
|||
|
|
@ -33,14 +33,18 @@ def build_scrape_executor(scrape_fn: ScrapeFn | None = None) -> Executor:
|
|||
maxReviews=payload.max_reviews,
|
||||
maxImages=payload.max_images,
|
||||
)
|
||||
emit_progress("starting", "Searching Google Maps", total=payload.max_places, unit="place")
|
||||
emit_progress(
|
||||
"starting", "Searching Google Maps", total=payload.max_places, unit="place"
|
||||
)
|
||||
try:
|
||||
items = await scrape_fn(actor_input)
|
||||
except SignInRequiredError as exc:
|
||||
raise ForbiddenError(
|
||||
f"Google sign in required: {exc}", code="GOOGLE_SIGNIN_REQUIRED"
|
||||
) from exc
|
||||
emit_progress("done", f"Scraped {len(items)} place(s)", current=len(items), unit="place")
|
||||
emit_progress(
|
||||
"done", f"Scraped {len(items)} place(s)", current=len(items), unit="place"
|
||||
)
|
||||
return ScrapeOutput(items=items)
|
||||
|
||||
return execute
|
||||
|
|
|
|||
|
|
@ -43,7 +43,12 @@ def build_scrape_executor(scrape_fn: ScrapeFn | None = None) -> Executor:
|
|||
unit="page",
|
||||
)
|
||||
items = await scrape_fn(actor_input, limit=_MAX_SERP_ITEMS)
|
||||
emit_progress("done", f"Scraped {len(items)} SERP page(s)", current=len(items), unit="page")
|
||||
emit_progress(
|
||||
"done",
|
||||
f"Scraped {len(items)} SERP page(s)",
|
||||
current=len(items),
|
||||
unit="page",
|
||||
)
|
||||
return ScrapeOutput(items=items)
|
||||
|
||||
return execute
|
||||
|
|
|
|||
|
|
@ -36,7 +36,9 @@ def build_scrape_executor(scrape_fn: ScrapeFn | None = None) -> Executor:
|
|||
postDateLimit=payload.post_date_limit,
|
||||
commentDateLimit=payload.comment_date_limit,
|
||||
)
|
||||
emit_progress("starting", "Resolving Reddit targets", total=payload.max_items, unit="item")
|
||||
emit_progress(
|
||||
"starting", "Resolving Reddit targets", total=payload.max_items, unit="item"
|
||||
)
|
||||
try:
|
||||
items = await scrape_fn(actor_input, limit=payload.max_items)
|
||||
except RedditAccessBlockedError as exc:
|
||||
|
|
@ -46,7 +48,9 @@ def build_scrape_executor(scrape_fn: ScrapeFn | None = None) -> Executor:
|
|||
f"Reddit refused anonymous access: {exc}",
|
||||
code="REDDIT_ACCESS_BLOCKED",
|
||||
) from exc
|
||||
emit_progress("done", f"Scraped {len(items)} item(s)", current=len(items), unit="item")
|
||||
emit_progress(
|
||||
"done", f"Scraped {len(items)} item(s)", current=len(items), unit="item"
|
||||
)
|
||||
return ScrapeOutput(items=items)
|
||||
|
||||
return execute
|
||||
|
|
|
|||
|
|
@ -60,7 +60,9 @@ def build_crawl_executor(engine: WebCrawlerConnector | None = None) -> Executor:
|
|||
unit="page",
|
||||
)
|
||||
items = [_to_item(page, payload.maxLength) for page in pages]
|
||||
emit_progress("done", f"Crawled {len(items)} page(s)", current=len(items), unit="page")
|
||||
emit_progress(
|
||||
"done", f"Crawled {len(items)} page(s)", current=len(items), unit="page"
|
||||
)
|
||||
return CrawlOutput(
|
||||
items=items,
|
||||
contacts=_aggregate_contacts(items),
|
||||
|
|
|
|||
|
|
@ -165,7 +165,8 @@ class CrawlItem(BaseModel):
|
|||
default=None, description="Crawl provenance (loaded URL, depth, referrer)."
|
||||
)
|
||||
markdown: str | None = Field(
|
||||
default=None, description="Cleaned page content as markdown (null unless success)."
|
||||
default=None,
|
||||
description="Cleaned page content as markdown (null unless success).",
|
||||
)
|
||||
metadata: dict[str, str] | None = Field(
|
||||
default=None, description="Page metadata such as title and description."
|
||||
|
|
|
|||
|
|
@ -25,9 +25,19 @@ def build_comments_executor(scrape_fn: CommentsFn | None = None) -> Executor:
|
|||
maxComments=payload.max_comments,
|
||||
sortCommentsBy=payload.sort_by,
|
||||
)
|
||||
emit_progress("starting", "Fetching YouTube comments", total=payload.max_comments, unit="comment")
|
||||
emit_progress(
|
||||
"starting",
|
||||
"Fetching YouTube comments",
|
||||
total=payload.max_comments,
|
||||
unit="comment",
|
||||
)
|
||||
items = await scrape_fn(actor_input)
|
||||
emit_progress("done", f"Scraped {len(items)} comment(s)", current=len(items), unit="comment")
|
||||
emit_progress(
|
||||
"done",
|
||||
f"Scraped {len(items)} comment(s)",
|
||||
current=len(items),
|
||||
unit="comment",
|
||||
)
|
||||
return CommentsOutput(items=items)
|
||||
|
||||
return execute
|
||||
|
|
|
|||
|
|
@ -31,9 +31,16 @@ def build_scrape_executor(scrape_fn: ScrapeFn | None = None) -> Executor:
|
|||
downloadSubtitles=payload.download_subtitles,
|
||||
subtitlesLanguage=payload.subtitles_language,
|
||||
)
|
||||
emit_progress("starting", "Resolving YouTube targets", total=payload.max_results, unit="video")
|
||||
emit_progress(
|
||||
"starting",
|
||||
"Resolving YouTube targets",
|
||||
total=payload.max_results,
|
||||
unit="video",
|
||||
)
|
||||
items = await scrape_fn(actor_input)
|
||||
emit_progress("done", f"Scraped {len(items)} video(s)", current=len(items), unit="video")
|
||||
emit_progress(
|
||||
"done", f"Scraped {len(items)} video(s)", current=len(items), unit="video"
|
||||
)
|
||||
return ScrapeOutput(items=items)
|
||||
|
||||
return execute
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue