mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-07-26 23:51:14 +02:00
feat: validate youtube scrape and comments URLs
This commit is contained in:
parent
4e4b9236c3
commit
babefecee7
2 changed files with 4 additions and 2 deletions
|
|
@ -10,6 +10,7 @@ from typing import Literal
|
||||||
|
|
||||||
from pydantic import BaseModel, Field
|
from pydantic import BaseModel, Field
|
||||||
|
|
||||||
|
from app.capabilities.core.validation import HttpUrlStr
|
||||||
from app.proprietary.platforms.youtube import CommentItem
|
from app.proprietary.platforms.youtube import CommentItem
|
||||||
|
|
||||||
MAX_COMMENT_VIDEOS = 20
|
MAX_COMMENT_VIDEOS = 20
|
||||||
|
|
@ -17,7 +18,7 @@ MAX_COMMENT_VIDEOS = 20
|
||||||
|
|
||||||
|
|
||||||
class CommentsInput(BaseModel):
|
class CommentsInput(BaseModel):
|
||||||
urls: list[str] = Field(
|
urls: list[HttpUrlStr] = Field(
|
||||||
min_length=1,
|
min_length=1,
|
||||||
max_length=MAX_COMMENT_VIDEOS,
|
max_length=MAX_COMMENT_VIDEOS,
|
||||||
description="YouTube video URLs to fetch comments (and replies) for (1-20).",
|
description="YouTube video URLs to fetch comments (and replies) for (1-20).",
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ from __future__ import annotations
|
||||||
|
|
||||||
from pydantic import BaseModel, Field, model_validator
|
from pydantic import BaseModel, Field, model_validator
|
||||||
|
|
||||||
|
from app.capabilities.core.validation import HttpUrlStr
|
||||||
from app.proprietary.platforms.youtube import VideoItem
|
from app.proprietary.platforms.youtube import VideoItem
|
||||||
|
|
||||||
MAX_YOUTUBE_SOURCES = 20
|
MAX_YOUTUBE_SOURCES = 20
|
||||||
|
|
@ -17,7 +18,7 @@ MAX_YOUTUBE_SOURCES = 20
|
||||||
|
|
||||||
|
|
||||||
class ScrapeInput(BaseModel):
|
class ScrapeInput(BaseModel):
|
||||||
urls: list[str] = Field(
|
urls: list[HttpUrlStr] = Field(
|
||||||
default_factory=list,
|
default_factory=list,
|
||||||
max_length=MAX_YOUTUBE_SOURCES,
|
max_length=MAX_YOUTUBE_SOURCES,
|
||||||
description=(
|
description=(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue