Skip to content

TikTok API #109

@s2t2

Description

@s2t2

There is a wrapper package but it's kind of buggy / not well documented.

It doesn't work in Colab / notebooks.

Some endpoints don't seem to work locally, but some do.

Installation

Depends on lower-level "playwright" dependency:

pip install TikTokApi==5.2.2
python -m playwright install

Usage

Context manager approach:

with TikTokApi() as api:
    tag = api.hashtag(name="funny")

    print(tag.info())

    for video in tag.videos():
        print(video.id)

Alternative approach:

api = TikTokApi()
print(dir(api))
print("-------------")

tag = api.hashtag(name="funny")
print(type(tag))
print(tag.info())

for video in tag.videos():
    print(type(video)) #> <class 'TikTokApi.api.video.Video'>
    print(video.id)

# if not using the "with" context manager approach, manually close:
api.shutdown()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions