TikTok-Api icon indicating copy to clipboard operation
TikTok-Api copied to clipboard

[BUG] - TypeError: undefined is not a function | (user.videos)

Open Person-Account opened this issue 1 year ago • 2 comments

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:

  1. Updating to python 3.12
  2. Disabling stealth
  3. Adding a try except to resp
  4. Changing Client eg. webkit mozzilla
  5. Changing to the latest Playwright version webkit (It happend less)
  6. 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

Person-Account avatar Dec 21 '24 05:12 Person-Account

had You tried it with python 3.10

madxion avatar Dec 22 '24 10:12 madxion

Same random errors

stirk1337 avatar Dec 25 '24 07:12 stirk1337