Skip to content

accept string types for SubtitleData#90

Open
edo44 wants to merge 1 commit into
Russell-Newton:mainfrom
edo44:patch-1
Open

accept string types for SubtitleData#90
edo44 wants to merge 1 commit into
Russell-Newton:mainfrom
edo44:patch-1

Conversation

@edo44

@edo44 edo44 commented Oct 20, 2024

Copy link
Copy Markdown
class SubtitleData(TitleCaseModel):
    version: int = Field(alias="Version")

throws out:

| 2024-10-20 07:46:31,775 - tiktok_bot - ERROR - Validation error in AsyncTikTokAPI: 1 validation error for VideoPage
| itemInfo.itemStruct.video.subtitleInfos.0.Version
| Input should be a valid integer, unable to parse string as an integer [type=int_parsing, input_value='1:whisper_lid', input_type=str]
| For further information visit https://errors.pydantic.dev/2.9/v/int_parsing

we can add accept both integers and strings in SubtitleData

change the version field line to accept both integers and strings:

class SubtitleData(TitleCaseModel):
    language_id: Optional[int] = Field(alias="LanguageID", default=None)
    language_code_name: str = Field(alias="LanguageCodeName")
    url: str = Field(alias="Url")
    url_expire: int = Field(alias="UrlExpire")
    format: str = Field(alias="Format")
    version: Union[int, str] = Field(alias="Version")
    source: str = Field(alias="Source")
    size: int = Field(alias="Size")

@hytradebridge hytradebridge left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hoping this can be merged soon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants