Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] can't get video info through shared link (vm.tiktok.com)only with link copied directly through browser (tiktok.com) #61

Closed
Albert-Bruun-Thomsen opened this issue Jul 25, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@Albert-Bruun-Thomsen
Copy link

Albert-Bruun-Thomsen commented Jul 25, 2023

Describe the bug
can't get video info through shared link (vm.tiktok.com)only with link copied directly through browser (tiktok.com)

To Reproduce
Steps to reproduce the behavior:
writing

with TikTokAPI() as api:
    video = api.video("https://www.tiktok.com/@giaitrihaihuoc23/video/7248572478757391643?_r=1&_t=8eGXRQForn9")

does as you would expect and gets the video info however doing it through a link shared through the app like this:

with TikTokAPI() as api:
    video = api.video("https://vm.tiktok.com/ZGJq2Yobp/")

throws these errors:

Traceback (most recent call last):
  File "C:\Users\alber\PycharmProjects\TiktokToShorts\bot.py", line 22, in <module>
    video = api.video(video_url)
  File "C:\Users\alber\PycharmProjects\TiktokToShorts\venv\lib\site-packages\tiktokapipy\api.py", line 171, in video
    return self._extract_video_from_response(response)
  File "C:\Users\alber\PycharmProjects\TiktokToShorts\venv\lib\site-packages\tiktokapipy\api.py", line 297, in _extract_video_from_response
    raise TikTokAPIError(
tiktokapipy.TikTokAPIError: Error in video extraction: status code 10201 (Unknown Error)
Process finished with exit code 1

Version Information
pydantic 2.0.4
playwright 1.36.0
tiktokapipy 0.2.1

System Information
win11, pycharm, latest python version

Region Information
Located in denmark

@Albert-Bruun-Thomsen Albert-Bruun-Thomsen added the bug Something isn't working label Jul 25, 2023
@Albert-Bruun-Thomsen Albert-Bruun-Thomsen changed the title [BUG] can [BUG] can't get video info through shared link (vm.tiktok.com)only with link copied directly through browser (tiktok.com) Jul 25, 2023
@Russell-Newton
Copy link
Owner

Seems to be a duplicate of #58. After looking closer, the issue is definitely on my end with a change I made in 0.2.0 to how video extraction works. I'll resolve this shortly.

Russell-Newton added a commit that referenced this issue Jul 25, 2023
* #58, #61 - Resolved status code 10201 appearing when extracting videos from mobile app share links
* #59 - Suppressed two errors during user video iteration:
    * TypeError: `DeferredItemListIterator` no longer attempts to iterate over a None item_list
    * JSONDecodeError: `DeferredItemListIterator` cuts iteration short if an API request returns null JSON
@Russell-Newton
Copy link
Owner

This error should (hopefully) be fixed in version 0.2.2. It seems that the issue was actually related to a change I made to video extraction in 0.2.0. It looks for the video ID in the video URL, which is possible with a desktop URL, but the mobile app share links are shortened and don't contain that information.

@Albert-Bruun-Thomsen
Copy link
Author

Perfect it's working with both links now thanks for the quick solution

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants