


save_tiktok_multi_urls ( tiktok_videos, False, 'tiktok_data.csv', 1 ) If TikTok autobans the scraper, try changing the 1 to a higher number to increase the number of seconds between executions. To download metadata ONLY from the video URLs used in the preceding two lines of code (to also download the videos, change False to True). save_tiktok (, True, 'video_data.csv', 'chrome' ) To download another TikTok video and add its metadata to the same file as above: pyk. To download a single TikTok video and one line of metadata to the file "video_data.csv" ( 'chrome' can be changed to 'firefox' if necessary): pyk. Please note that functions that start with "get" will return data to working memory, while those starting with "save" will save data to disk without returning anything. Individuals employed by such institutions are advised to use Pyktok only within applicable laws and regulations. Please note that a number of US states have banned TikTok on state-owned devices, which may include IT resources provided by state universities. TikTok now offers an official research API to US-based academics- you can apply for access here. Some functions may require you to be logged in to TikTok, which means they may not work on cloud servers that don't have Chrome or Firefox installed. This program may stop working suddenly if TikTok changes how it stores its data (see Freelon, 2018). R users, check out traktok, an R port of Pyktok. Download full TikTok JSON data objects (in case you want to extract data from parts of the object not included in the above functions).Download 15-30 videos and/or metadata lines from hashtag, user, and music pages displaying multiple videos.

Pyktok pulls its data directly from the JSON objects embedded in Tiktok pages and from hidden APIs with no public documentation. We developed Pyktok ("pick-tock") because none of the existing TikTok data collection utilities we could find suited our needs. Thanks! PyktokĪ simple module to collect video, text, and metadata from TikTok. If you know anything about web scraping, help us out on the Issues page. Unfortunately Pyktok's video and comment downloading functions are broken as of Feb 10, 2023. March 16, 2023: Video downloading works again comment downloading is still broken.
