f
This commit is contained in:
parent
760568e571
commit
7ae458f626
@ -6,7 +6,10 @@ from datetime import datetime
|
||||
class ScrapeRequest(BaseModel):
|
||||
username: str
|
||||
seller_id: UUID
|
||||
# existing field
|
||||
max_count: int = Field(default=5, ge=1, le=50)
|
||||
# NEW: accept "count" from older/other callers; ignored if not present
|
||||
count: Optional[int] = Field(default=None, ge=1, le=50)
|
||||
|
||||
class ScrapedPost(BaseModel):
|
||||
ig_post_id: str
|
||||
|
||||
@ -116,7 +116,11 @@ def _collect_raw_not_in_db(
|
||||
return raw_to_save, final_cursor, pages
|
||||
|
||||
def scrape_and_store(db: Session, req: ScrapeRequest) -> List[ScrapedPost]:
|
||||
target = int(req.max_count)
|
||||
# Prefer "count" if provided by the caller, otherwise fall back to "max_count"
|
||||
target = int((req.count if getattr(req, "count", None) is not None else req.max_count))
|
||||
|
||||
# Optional debug line
|
||||
print(f"[SCRAPER] requested count={getattr(req, 'count', None)} max_count={req.max_count} → resolved target={target}")
|
||||
|
||||
# since_taken_at (optional)
|
||||
since_ts: Optional[int] = None
|
||||
|
||||
Loading…
Reference in New Issue
Block a user