# Tiktok Hashtag Scraper (`epctex/tiktok-hashtag-scraper`) Actor

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.

- **URL**: https://apify.com/epctex/tiktok-hashtag-scraper.md
- **Developed by:** [epctex](https://apify.com/epctex) (community)
- **Categories:** Social media, SEO tools
- **Stats:** 467 total users, 14 monthly users, 99.7% runs succeeded, 16 bookmarks
- **User rating**: 5.00 out of 5 stars

## Pricing

from $0.30 / 1,000 dataset items

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## Actor - TikTok Hashtag Scraper

### TikTok Hashtag Scraper

Extract videos from any TikTok hashtag by keyword or URL with transparent, event-based pricing.

The TikTok Hashtag Scraper supports the following features:

- Search any hashtag by keyword or provide hashtag URLs directly.

- Extract full video data including descriptions, stats, author info, and music details.

- Limit output by page count or total item count for cost control.

### 💰 Pricing

This actor uses event-based pricing — you only pay for what you use.

| Event | Price | Notes |
| ----- | ----- | ----- |
| **Tag Query** | $0.006 per hashtag | First ~20 videos included FREE |
| **Dataset Item** | $0.0003 per item | Charged for each video beyond the free ~20 |

#### Cost Examples

| Scenario | Charges | Calculation | Total |
| -------- | ------- | ----------- | ----- |
| 1 hashtag, 20 videos | 1 tag query | $0.006 | **$0.006** |
| 1 hashtag, 100 videos | 1 tag query + 80 items | $0.006 + ($0.0003 × 80) | **$0.030** |
| 5 hashtags, 100 videos each | 5 tag queries + 400 items | ($0.006 × 5) + ($0.0003 × 400) | **$0.150** |
| 10 hashtags, 50 videos each | 10 tag queries + 300 items | ($0.006 × 10) + ($0.0003 × 300) | **$0.150** |

### Bugs, fixes, updates, and changelog

This scraper is under active development. If you have any feature requests you can create an issue from [here](https://github.com/epctex-support/tiktok-hashtag-scraper/issues).

### Input Parameters

The input of this scraper should be JSON containing the list of hashtags or URLs to scrape. Possible fields are:

- `search`: (Optional) (Array) List of TikTok hashtag keywords to search (e.g. `anime`, `music`).

- `startUrls`: (Optional) (Array) List of TikTok hashtag URLs to scrape directly.

- `endPage`: (Optional) (Number) Final page number to scrape. Default is `Infinite`. Applies to each search/URL individually.

- `maxItems`: (Optional) (Number) Maximum number of videos to retrieve in total.

- `customMapFunction`: (Optional) (String) JavaScript function to transform each output item.

#### Input Example

```json
{
  "search": ["anime", "tiktok"],
  "startUrls": [
    "https://www.tiktok.com/search?q=%23music&t=1670685477846"
  ],
  "maxItems": 100,
  "endPage": 2
}
```

### During the Run

During the run, the actor will output messages letting you know what is going on. Each message always contains a short label specifying which page from the provided list is currently specified.
When items are loaded from the page, you should see a message about this event with a loaded item count and total item count for each page.

If you provide incorrect input to the actor, it will immediately stop with a failure state and output an explanation of what is wrong.

### Tiktok Hashtag Export

During the run, the actor stores results into a dataset. Each item is a separate item in the dataset.

You can manage the results in any language (Python, PHP, Node JS/NPM). See the FAQ or <a href="https://www.apify.com/docs/api" target="blank">our API reference</a> to learn more about getting results from this Tiktok Hashtag actor.

### Other Tiktok Scrapers

If you need different functionalities or all at once, we have solutions for each of them. You can check;

- [Tiktok Video Scraper](https://apify.com/epctex/tiktok-video-scraper?fpr=yhdrb)
- [Tiktok Search Scraper](https://apify.com/epctex/tiktok-search-scraper?fpr=yhdrb)
- [Tiktok Hashtag Scraper](https://apify.com/epctex/tiktok-hashtag-scraper?fpr=yhdrb)

### Scraped Tiktok Hashtag Properties

The structure of each item in the Tiktok Hashtag looks like this:

#### Item Detail

```json
{
	"inputSource": "https://www.tiktok.com/search?q=%23music&t=1670685477846",
	"url": "https://www.tiktok.com/@444talen/video/7600210239350246687",
	"id": "7600210239350246687",
	"desc": "thanks mikaela for catching this #fyp #niche #music #relatable ",
	"createTime": 1769561852,
	"video": {
		"id": "7600210239350246687",
		"width": 720,
		"height": 1280,
		"ratio": "720p",
		"duration": 7.3,
		"cover": "https://p16-pu-sign-useast8.tiktokcdn-us.com/tos-useast8-p-0068-tx2/oAfu01GOQE6FK6aIVwSIyDNCeQRsquDfAACFTj~tplv-tiktokx-origin.image?dr=1370&refresh_token=36560718&x-expires=1773496800&x-signature=UPDEoRkwPuXID2ysMt6N3Wl%2FIdE%3D&t=bacd0480&ps=933b5bde&shp=d05b14bd&shcp=c0f880ed&idc=my&biz_tag=tt_video&s=CHALLENGE_AWEME&sc=cover",
		"playAddr": "https://v45-eu-p.tiktokcdn.com/1b379ea8d0fe4a1dd3aa852e93c8ca39/69b56a1a/video/tos/maliva/tos-maliva-ve-0068c799-us/oQAiUHXBRiEw1Mh5LaBWAVvd3E6XQl3VBidIC/?a=1233&bti=NXYpNDs8QGo6OjZAOm00NTAuYCMxNDNg&ch=0&cr=13&dr=0&er=0&lr=all&net=0&cd=0%7C0%7C0%7C&cv=1&br=3466&bt=1733&cs=0&ds=3&ft=XsdJYqgmmklPD12Kfk.s3wUlNa3qjeF~O5&mime_type=video_mp4&qs=0&rc=aGg1ZjM0Mzs8PDNpPDM8N0Bpandlb3Q5cmVvODMzaTczNEA0Ly1hXjEuXjAxMzU0MDBiYSMwYmRkMmRrbnBhLS1kMTJzcw%3D%3D&vvpl=1&l=202603132200502DB1BDA27DE8B10E5951&btag=e000b5000",
		"originCover": "https://p16-pu-sign-useast8.tiktokcdn-us.com/tos-useast8-p-0068-tx2/oAfu01GOQE6FK6aIVwSIyDNCeQRsquDfAACFTj~tplv-tiktokx-origin.image?dr=1370&refresh_token=36560718&x-expires=1773496800&x-signature=UPDEoRkwPuXID2ysMt6N3Wl%2FIdE%3D&t=bacd0480&ps=933b5bde&shp=d05b14bd&shcp=c0f880ed&idc=my&biz_tag=tt_video&s=CHALLENGE_AWEME&sc=cover"
	},
	"author": "talen",
	"music": {
		"id": 7390491186387357000,
		"title": "I LOVE IT",
		"authorName": "pixie!! ★ goofy goober",
		"album": null,
		"duration": 16,
		"coverThumb": "https://p19-common-sign-useastred.tiktokcdn-eu.com/tos-useast2a-avt-0068-euttp/f8cce3d0438f7d221b82adb692826338~tplv-tiktokx-cropcenter-q:1080:1080:q70.heic?dr=10796&idc=my&ps=87d6e48a&refresh_token=6462b45e&s=CHALLENGE_AWEME&sc=avatar&shcp=c0f880ed&shp=d05b14bd&t=223449c4&x-expires=1773496800&x-signature=%2FK8buLTy6lKZodM%2BDRFHEaxaOFM%3D"
	},
	"authorStats": {
		"followerCount": null,
		"followingCount": null,
		"videoCount": null
	},
	"adAuthorization": true,
	"nickname": "444talen",
	"authorId": "7063947703336387631",
	"avatarThumb": "https://p16-sign-va.tiktokcdn.com/tos-maliva-avt-0068/1f93a4adb4d67eacdd9f7c7bcdd8ef52~tplv-tiktokx-cropcenter-q:1080:1080:q70.heic?dr=10796&idc=my&ps=87d6e48a&refresh_token=08dc580c&s=CHALLENGE_AWEME&sc=avatar&shcp=c0f880ed&shp=d05b14bd&t=223449c4&x-expires=1773496800&x-signature=S82lfhZIoGmIPnRar56%2FPH278TU%3D",
	"stats": {
		"diggCount": 296878,
		"shareCount": 19042,
		"commentCount": 498,
		"playCount": 1311627
	}
}
```

### Contact

Please visit us through [epctex.com](https://epctex.com) to see all the products that are available for you. If you are looking for any custom integration or so, please reach out to us through the chat box in [epctex.com](https://epctex.com). In need of support? <business@epctex.com> is at your service.

# Actor input Schema

## `search` (type: `array`):

TikTok hashtag keywords to search (e.g. anime, music). Each keyword triggers a Tag Query charge.

## `startUrls` (type: `array`):

TikTok hashtag URLs to scrape directly. Each URL triggers a Tag Query charge.

## `maxItems` (type: `integer`):

Maximum number of items that you want to scrape

## `endPage` (type: `integer`):

The page number that you want to end with. By default there is no end page.

## `extendOutputFunction` (type: `string`):

Function that takes a JQuery handle ($) as argument and returns data that will be merged with the default output

## `customMapFunction` (type: `string`):

JavaScript function to transform each output item. Not intended for filtering.

## Actor input object example

```json
{
  "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": 1000,
  "endPage": 1,
  "extendOutputFunction": "($) => { return {} }",
  "customMapFunction": "(object) => { return {...object} }"
}
```

# Actor output Schema

## `overview` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your 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": 1000,
    "endPage": 1,
    "extendOutputFunction": ($) => { return {} },
    "customMapFunction": (object) => { return {...object} }
};

// 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');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_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": 1000,
    "endPage": 1,
    "extendOutputFunction": "($) => { return {} }",
    "customMapFunction": "(object) => { return {...object} }",
}

# Run the Actor and wait for it to finish
run = client.actor("epctex/tiktok-hashtag-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "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": 1000,
  "endPage": 1,
  "extendOutputFunction": "($) => { return {} }",
  "customMapFunction": "(object) => { return {...object} }"
}' |
apify call epctex/tiktok-hashtag-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=epctex/tiktok-hashtag-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/7lYFx41I8vv371L9D/builds/wTXfYSxfdefqzuV1E/openapi.json
