TikTok-Api
TikTok-Api copied to clipboard
[BUG] - TypeError: undefined is not a function | (user.videos)
Bug:
Started getting this issue about a week ago and progressively it has gone worse. It cannot be replicated as it is random when and how the exception TypeError happens on sending the request and getting the resp action. Waiting intervals does not do anything or mouse movements. Does anyone have a solution please?
Things I tried:
- Updating to python 3.12
- Disabling stealth
- Adding a try except to resp
- Changing Client eg. webkit mozzilla
- Changing to the latest Playwright version webkit (It happend less)
- Rotation
Raises exception:
async for video in user.videos():
Full code:
from TikTokApi import TikTokApi
import asyncio
import os
ms_token = "my_token_pasted_in_manually"
async def user_example():
async with TikTokApi() as api:
await api.create_sessions(headless=True, ms_tokens=[ms_token], num_sessions=1, sleep_after=3)
user = api.user("therock")
vids = []
async for video in user.videos():
vids.append(video)
# Do stuff...
if __name__ == "__main__":
asyncio.run(user_example())
TypeError:
TypeError: undefined is not a function
at b (https://lf16-tiktok-web.tiktokcdn-us.com/obj/tiktok-web-tx/webmssdk/2.0.0.295/webmssdk.js:1:46160)
at Array.Ab (https://lf16-tiktok-web.tiktokcdn-us.com/obj/tiktok-web-tx/webmssdk/2.0.0.295/webmssdk.js:1:43974)
at n (https://lf16-tiktok-web.tiktokcdn-us.com/obj/tiktok-web-tx/webmssdk/2.0.0.295/webmssdk.js:1:89436)
at window.fetch (https://lf16-cdn-tos.tiktokcdn-us.com/obj/static-tx/secsdk/secsdk-lastest.umd.js:1036:38)
at eval (eval at evaluate (:201:30), <anonymous>:3:21)
at new Promise (<anonymous>)
at eval (eval at evaluate (:201:30), <anonymous>:2:24)
at UtilityScript.evaluate (<anonymous>:208:19)
at UtilityScript.<anonymous> (<anonymous>:1:44)
Log:
name 'resp' is not defined
- OS: Debian minimal distribution.
- TikTokApi Version Latest Clone using the web URL.
Extra:
When I get the resp everyting works such as_dict etc
had You tried it with python 3.10
Same random errors