Tiktok Hashtag Scraper

  • epctex/tiktok-hashtag-scraper
  • Modified
  • Users 112
  • Runs 683
  • Created by Author's avatarepctex

Experience the power of our state-of-the-art TikTok scraper, meticulously designed to fetch videos, hashtags, shares, followers, hearts, names, posts, URLs, and music data. Obtain comprehensive insights with ease, and choose your preferred data format: be it HTML, JSON, CSV, Excel, or XML.

Free trial for 3 days

Then $30.00/month

No credit card required now

Tiktok Hashtag Scraper

Free trial for 3 days

Then $30.00/month

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=%23music&t=1670685477846",
        "https://www.tiktok.com/search?q=%23dance&t=1670685484412",
        "https://www.tiktok.com/search?q=%23challenge&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-hashtag-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);
    });
})();