feat(tiktok): emit graceful ErrorItem for blocked/empty listings

Profile and search feeds are trust-gated: an anonymous headless session
gets an empty item_list (profile) or no results XHR (search), while
hashtag feeds load. A zero-item listing now yields one honest ErrorItem
(errorCode="no_items") instead of vanishing silently, and ErrorItems are
excluded from billing so a blocked target is surfaced but never charged.
This commit is contained in:
CREDO23 2026-07-08 23:14:50 +02:00
parent f731d371ab
commit ba375ea3ee
5 changed files with 96 additions and 14 deletions

View file

@ -82,5 +82,6 @@ class ScrapeOutput(BaseModel):
@property
def billable_units(self) -> int:
"""One returned item = one billable unit."""
return len(self.items)
"""One returned video = one billable unit; ErrorItems (``errorCode`` set,
for blocked/empty targets) are surfaced but never charged."""
return sum(1 for item in self.items if not getattr(item, "errorCode", None))