Use save_tiktok_multi_page() to scrape approximately 30 metadata lines from specific TikTok entity pages.
Parameters:
query: The username, hashtag, or video URL depending on ent_type.ent_type: One of 'user', 'hashtag', or 'video_related'.save_video: Boolean. If True, downloads the videos.metadata_fn: The filename for the resulting CSV.
Troubleshooting: If you encounter an EmptyResponseException, try setting headless=False (though this parameter is not explicitly shown in the usage examples, it is mentioned as a solution).
import pyktok as pyk
# Scrape a user page
pyk.save_tiktok_multi_page('tiktok', ent_type='user', save_video=False, metadata_fn='tiktok.csv')
# Scrape a hashtag page
pyk.save_tiktok_multi_page('datascience', ent_type='hashtag', save_video=False, metadata_fn='datascience.csv')
# Scrape related videos from a specific video page
pyk.save_tiktok_multi_page('https://www.tiktok.com/@tiktok/video/7106594312292453675', ent_type='video_related', save_video=False, metadata_fn='7106594312292453675.csv')