AsyncTikTokAPI
- class AsyncTikTokAPI(*, headless=None, data_dump_file=None, navigation_timeout=30, navigation_retries=0, context_kwargs=None, navigator_type=None, **kwargs)[source]
Bases:
TikTokAPI
Asynchronous API used to scrape data from TikTok
- Parameters:
headless (
Optional
[bool
], default:None
) – Whether to use headless browsing.data_dump_file (
Optional
[str
], default:None
) – If the data scraped from TikTok should also be dumped to a JSON file before parsing, specify the name of the dump file (excluding ‘.json’).navigation_timeout (
float
, default:30
) – How long (in milliseconds) page navigation should wait before timing out. Set to 0 to disable the timeout.navigation_retries (
int
, default:0
) – How many times to retry navigation ifnetwork_timeout
is exceeded. Set to 0 to not retry navigation.context_kwargs (
Optional
[dict
], default:None
) – Any extra kwargs used to initialize the playwright browser context. For full details, see Browser::new_context().navigator_type (
Optional
[Literal
['Firefox'
,'firefox'
,'Chromium'
,'chromium'
]], default:None
) – DEPRECATED as of 0.1.13, left in for backwards-compatibility.kwargs – Any extra kwargs used to initialize the playwright browser (e.g.: proxy, etc.). For full details, see BrowserType::launch().
Attributes
The playwright Browser instance used for data scraping
The playwright Context instance used for data scraping
The playwright instance used for data scraping
Methods
Retrieve data on a
Challenge
(hashtag) from TikTok.Retrieve data on a
User
from TikTok.Retrieve data on a
Video
from TikTok.- async challenge(challenge_name, *, video_limit=-1)[source]
Retrieve data on a
Challenge
(hashtag) from TikTok. Only up to thevideo_limit
most recent videos will be retrievable by the scraper.
- async user(user, *, video_limit=-1)[source]
Retrieve data on a
User
from TikTok. Only up to thevideo_limit
most recent videos will be retrievable by the scraper.
- async video(link_or_id)[source]
Retrieve data on a
Video
from TikTok. If the video is a slideshow,emulate_mobile
must be set toTrue
at API initialization or this method will raise aTikTokAPIError
.
- property browser
The playwright Browser instance used for data scraping
- property context
The playwright Context instance used for data scraping
- property playwright
The playwright instance used for data scraping