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

[BUG] - AttributeError: parent doesn't exist on TikTokApi.api.Video

Open bumothekid opened this issue 2 years ago • 2 comments

Bug description

The code says that there's no parent/that this TikTok is not an duet or stitch of an TikTok and that's true. I just want to get the bytes from the video.

The buggy code

    video = TikTokApi.video(url=url) # error here
    videoName = video.as_dict
    videoBytes = video.bytes()

    with open("tiktok/video.mp4", "wb") as output:
        output.write(videoBytes)

Expected behavior

I'm trying to get the Tiktok Video then getting the bytes and writing it to an mp4 file

Screenshot 2022-07-05 at 5 22 47 PM

Laptop:

  • OS: MacOS Monterey 12.4
  • TikTokApi Version Up to date

bumothekid avatar Jul 05 '22 15:07 bumothekid

It's not bugged, you have to first build the API object. Try:

    api = TikTokApi()
    video = api.video(url=url) # error here
    videoName = video.as_dict
    videoBytes = video.bytes()

    with open("tiktok/video.mp4", "wb") as output:
        output.write(videoBytes)

keko950 avatar Aug 08 '22 12:08 keko950

@keko950 still its not working, I am getting the following error. 'AttributeError: 'TikTokApi' object has no attribute 'video' '

farazBhatti avatar Aug 17 '22 11:08 farazBhatti

I assume this is fixed in V6 lmk

davidteather avatar Aug 08 '23 22:08 davidteather