TikTokApi.api.sound module

class TikTokApi.api.sound.Sound(id: str | None = None, data: str | None = None)[source]

Bases: object

A TikTok Sound/Music/Song.

Example Usage
song = api.song(id='7016547803243022337')
author: User | None

The author of the song (if it exists)

duration: int | None

The duration of the song in seconds.

id: str

TikTok’s ID for the sound

async info(**kwargs) dict[source]

Returns all information sent by TikTok related to this sound.

Returns:

The raw data returned by TikTok.

Return type:

dict

Raises:

InvalidResponseException – If TikTok returns an invalid response, or one we don’t understand.

Example Usage:
sound_info = await api.sound(id='7016547803243022337').info()
original: bool | None

Whether the song is original or not.

parent: ClassVar[TikTokApi]
title: str | None

The title of the song.

async videos(count=30, cursor=0, **kwargs) Iterator[Video][source]

Returns Video objects of videos created with this sound.

Parameters:
  • count (int) – The amount of videos you want returned.

  • cursor (int) – The the offset of videos from 0 you want to get.

Returns:

Yields TikTokApi.video objects.

Return type:

async iterator/generator

Raises:

InvalidResponseException – If TikTok returns an invalid response, or one we don’t understand.

Example Usage:
async for video in api.sound(id='7016547803243022337').videos():
    # do something