Skip to content

Change type of SubtitleData.format field to str#86

Open
amadejkastelic wants to merge 1 commit into
Russell-Newton:mainfrom
amadejkastelic:main
Open

Change type of SubtitleData.format field to str#86
amadejkastelic wants to merge 1 commit into
Russell-Newton:mainfrom
amadejkastelic:main

Conversation

@amadejkastelic

@amadejkastelic amadejkastelic commented Jul 4, 2024

Copy link
Copy Markdown
Contributor

SubtitleData.format field can also be a string. Here is one such example:

video-embed-bot_1  | 2024-07-04 22:04:07,035 ERROR Failed downloading https://vm.tiktok.com/ZGesWbcYj/: 1 validation error for VideoPage
video-embed-bot_1  | itemInfo.itemStruct.video.subtitleInfos.0.Version
video-embed-bot_1  |   Input should be a valid integer, unable to parse string as an integer [type=int_parsing, input_value='1:whisper_lid', input_type=str]
video-embed-bot_1  |     For further information visit https://errors.pydantic.dev/2.7/v/int_parsing
video-embed-bot_1  | 2024-07-04 22:04:07,534 ERROR Ignoring exception in on_message
video-embed-bot_1  | Traceback (most recent call last):
video-embed-bot_1  |   File "/root/.local/share/virtualenvs/app-4PlAip0Q/lib/python3.12/site-packages/discord/client.py", line 449, in _run_event
video-embed-bot_1  |     await coro(*args, **kwargs)
video-embed-bot_1  |   File "/app/bots/discord/client.py", line 73, in on_message
video-embed-bot_1  |     raise e
video-embed-bot_1  |   File "/app/bots/discord/client.py", line 66, in on_message
video-embed-bot_1  |     post = await client.get_post()
video-embed-bot_1  |            ^^^^^^^^^^^^^^^^^^^^^^^
video-embed-bot_1  |   File "/app/downloader/tiktok.py", line 31, in get_post
video-embed-bot_1  |     video = await api.video(clean_url)
video-embed-bot_1  |             ^^^^^^^^^^^^^^^^^^^^^^^^^^
video-embed-bot_1  |   File "/root/.local/share/virtualenvs/app-4PlAip0Q/lib/python3.12/site-packages/tiktokapipy/async_api.py", line 191, in video
video-embed-bot_1  |     response = VideoPage.model_validate(
video-embed-bot_1  |                ^^^^^^^^^^^^^^^^^^^^^^^^^
video-embed-bot_1  |   File "/root/.local/share/virtualenvs/app-4PlAip0Q/lib/python3.12/site-packages/pydantic/main.py", line 551, in model_validate
video-embed-bot_1  |     return cls.__pydantic_validator__.validate_python(
video-embed-bot_1  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
video-embed-bot_1  | pydantic_core._pydantic_core.ValidationError: 1 validation error for VideoPage
video-embed-bot_1  | itemInfo.itemStruct.video.subtitleInfos.0.Version
video-embed-bot_1  |   Input should be a valid integer, unable to parse string as an integer [type=int_parsing, input_value='1:whisper_lid', input_type=str]

Tested by monkey-patching the lib.

@amadejkastelic

amadejkastelic commented Jul 4, 2024

Copy link
Copy Markdown
Contributor Author

Tests failed due to #82. I think this is safe to merge.

@hytradebridge

Copy link
Copy Markdown

any updates?

@amadejkastelic

Copy link
Copy Markdown
Contributor Author

You can monkeypatch it like this in your code until (if ever) this gets merged: https://github.com/amadejkastelic/discord-video-embed-bot/blob/develop/bot%2Fintegrations%2Ftiktok%2F__init__.py

@edshee

edshee commented Oct 24, 2024

Copy link
Copy Markdown

You can monkeypatch it like this in your code until (if ever) this gets merged: https://github.com/amadejkastelic/discord-video-embed-bot/blob/develop/bot%2Fintegrations%2Ftiktok%2F__init__.py

Just wanted to say thank you for this. It's fixed the formatting error for me. Hopefully it'll get merged soon.

@jrmatos

jrmatos commented May 10, 2025

Copy link
Copy Markdown

can we merge this please?

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.

6 participants