
Tiktok Search Scraper
- epctex/tiktok-search-scraper
- Modified
- Users 255
- Runs 8.5k
- Created by
epctex
Unleash the power of data extraction with our advanced TikTok Search Scraper. Gather videos, hashtags, posts, URLs, share numbers, followers, hearts, names, music-related data, and more. Download data in various formats including HTML, JSON, CSV, Excel, or XML.
To run the code examples, you need to have an Apify account. Replace <YOUR_API_TOKEN> in the code with your API token. For a more detailed explanation, please read about running Actors via the API in Apify Docs.
import { ApifyClient } from 'apify-client';
// Initialize the ApifyClient with API token
const client = new ApifyClient({
token: '<YOUR_API_TOKEN>',
});
// Prepare Actor input
const input = {
"search": [
"anime",
"tiktok"
],
"startUrls": [
"https://www.tiktok.com/search?q=music&t=1670685477846",
"https://www.tiktok.com/search?q=dance&t=1670685484412",
"https://www.tiktok.com/search?q=challenge&t=1670685494590"
],
"maxItems": 10,
"endPage": 1,
"extendOutputFunction": ($) => { return {} },
"customMapFunction": (object) => { return {...object} },
"proxy": {
"useApifyProxy": true
}
};
(async () => {
// Run the Actor and wait for it to finish
const run = await client.actor("epctex/tiktok-search-scraper").call(input);
// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
console.dir(item);
});
})();