TikTokApi.api.hashtag module
- class TikTokApi.api.hashtag.Hashtag(name: str | None = None, id: str | None = None, data: dict | None = None)[source]
Bases:
object
A TikTok Hashtag/Challenge.
- Example Usage
hashtag = api.hashtag(name='funny') async for video in hashtag.videos(): print(video.id)
- as_dict: dict
The raw data associated with this hashtag.
- id: str | None
The ID of the hashtag
- async info(**kwargs) dict [source]
Returns all information sent by TikTok related to this hashtag.
- Example Usage
hashtag = api.hashtag(name='funny') hashtag_data = await hashtag.info()
- name: str | None
The name of the hashtag (omiting the #)
- async videos(count=30, cursor=0, **kwargs) Iterator[Video] [source]
Returns TikTok videos that have this hashtag in the caption.
- 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.hashtag(name='funny').videos(): # do something