15 lines
607 B
Python
15 lines
607 B
Python
from pydantic import BaseModel, Field
|
|
from datetime import datetime
|
|
from typing import Optional
|
|
|
|
class Article(BaseModel):
|
|
headline: str = Field(..., description="The headline of the article")
|
|
url: str = Field(..., description="The URL of the article")
|
|
body: str = Field(..., description="The main body text of the article")
|
|
scraped_at: datetime = Field(default_factory=datetime.utcnow, description="Timestamp of when the article was scraped")
|
|
|
|
class ScrapeResult(BaseModel):
|
|
articles: list[Article]
|
|
total_count: int
|
|
scraped_at: datetime = Field(default_factory=datetime.utcnow)
|