TikTokApi.api.search module
- class TikTokApi.api.search.Search[source]
Bases:
object
Contains static methods about searching TikTok for a phrase.
- static search_type(search_term, obj_type, count=10, cursor=0, **kwargs) Iterator [source]
Searches for a specific type of object. But you shouldn’t use this directly, use the other methods.
Note: Your ms_token needs to have done a search before for this to work. Note: Currently only supports searching for users, other endpoints require auth.
- Parameters:
search_term (str) – The phrase you want to search for.
obj_type (str) – The type of object you want to search for (user)
count (int) – The amount of users you want returned.
cursor (int) – The the offset of users 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 user in api.search.search_type('david teather', 'user'): # do something
- static users(search_term, count=10, cursor=0, **kwargs) Iterator[User] [source]
Searches for users.
Note: Your ms_token needs to have done a search before for this to work.
- Parameters:
search_term (str) – The phrase you want to search for.
count (int) – The amount of users you want returned.
- Returns:
Yields TikTokApi.user objects.
- Return type:
async iterator/generator
- Raises:
InvalidResponseException – If TikTok returns an invalid response, or one we don’t understand.
- Example Usage:
async for user in api.search.users('david teather'): # do something