# TikTok Hashtag Scraper (`codenest/tiktok-hashtag-scraper`) Actor

Input hashtags or TikTok video URLs, with options to set max videos per hashtag, enable comment scraping, and configure proxy settings. Outputs full video data: engagement metrics, direct video URLs, thumbnails, author info, music details, hashtags, mentions, and comments with author profiles.

- **URL**: https://apify.com/codenest/tiktok-hashtag-scraper.md
- **Developed by:** [CodeNest](https://apify.com/codenest) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 1,000 videos

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

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

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
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.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## 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.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## 🎵 TikTok Hashtag Scraper - Ultimate Hashtag Video & Comment Extractor

**Effortlessly scrape TikTok videos by hashtag with our powerful **TikTok Hashtag Scraper**! This Apify actor enables bulk hashtag-based video discovery, complete metadata extraction, engagement metrics, and optional comment scraping.**

***

### 📋 Overview

Need to track trending hashtags, analyze viral content, or build TikTok datasets? This **TikTok Hashtag Scraper** delivers:

- 🎯 **Hashtag-Based Discovery** - Scrape videos from multiple hashtags
- 📊 **Complete Video Metadata** - Titles, durations, engagement metrics
- 💬 **Comment Extraction** - Optional comment scraping with author details
- 🎵 **Music Information** - Track details and audio URLs
- 👤 **Author Profiles** - Creator usernames, nicknames, and avatars
- 🎬 **Direct Video URLs** - Downloadable video links
- 🌐 **Proxy Support** - Built-in Apify residential proxy integration

Perfect for social media managers 📈, trend analysts 📊, content creators 🎭, and researchers 🔬!

***

### ⭐ Core Capabilities of TikTok Hashtag Scraper

#### 🎯 Hashtag Discovery

- **Multiple Hashtag Support** - Scrape videos from multiple hashtags in one run
- **Configurable Limits** - Set max videos per hashtag
- **Direct Video URLs** - Scrape specific videos by URL
- **Trend Detection** - Discover trending content by hashtag

#### 📊 Video Data Extraction

- **Complete Video Info** - Title, duration, and source URL
- **Engagement Metrics** - Likes, comments, saves, shares, and plays
- **Video Download URLs** - Direct CDN video links
- **Thumbnail Extraction** - High-quality video covers

#### 💬 Comment Scraping

- **Comment Extraction** - Optional comment scraping per video
- **Author Details** - Commenter usernames, nicknames, avatars
- **Engagement Data** - Comment likes and reply counts
- **Timestamps** - Comment creation dates and times
- **Configurable Limits** - Set max comments per video

#### 🎵 Music & Author Data

- **Music Information** - Track ID, title, author, and play URL
- **Duration Detection** - Audio track length
- **Author Profiles** - Creator ID, username, nickname, avatar
- **Verification Status** - Author verification detection

#### 🏷️ Hashtag & Mention Extraction

- **Hashtag Detection** - All hashtags from video titles
- **Mention Detection** - All @mentions from titles
- **Multi-Hashtag Support** - Handle videos with multiple hashtags

***

### ⚙️ Input Configuration

Simply enter hashtags or video URLs, configure limits, and click "Start". Input looks like this:

```json
{
  "hashtags": [
    "viral",
    "challange",
    "video"
  ],
  "max_videos_per_hashtag": 50,
  "proxy": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  },
  "scrape_comments": true,
  "video_urls": [
    {
      "url": "https://www.tiktok.com/@alc.sakib2.0/video/7684494222770277650",
      "method": "GET"
    }
  ],
  "max_comments": 50
}
```

#### 📝 Input Specifications

| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| `hashtags` | Array | ❌ No | \[] | Hashtags to scrape videos from |
| `video_urls` | Array | ❌ No | \[] | Direct video URLs to scrape |
| `max_videos_per_hashtag` | Integer | ❌ No | 50 | Maximum videos per hashtag |
| `scrape_comments` | Boolean | ❌ No | false | Enable comment scraping |
| `max_comments` | Integer | ❌ No | 50 | Maximum comments per video |
| `proxy.useApifyProxy` | Boolean | ❌ No | true | Enable Apify proxy |
| `proxy.apifyProxyGroups` | Array | ❌ No | \["RESIDENTIAL"] | Proxy groups |

***

### 📤 Output Structure

Your **TikTok Hashtag Scraper** produces comprehensive video data with engagement metrics and comments:

```json
{
  "video_num": 1,
  "hashtag": "#viral",
  "id": "7691749083597294879",
  "source_url": "https://www.tiktok.com/@sky1760/video/7691749083597294879",
  "video_url": "https://v16m.tiktokcdn-us.com/...",
  "title": "Stank face  #fypシ #viral #music #forfun #fyp ",
  "duration": 14,
  "uploader": "Sky",
  "like_count": 2990,
  "comment_count": 32,
  "save_count": 410,
  "share_count": 92,
  "play_count": 24009,
  "thumbnail": "https://p19-common-sign.tiktokcdn-us.com/...",
  "hashtags": ["viral", "fypシ", "music", "forfun", "fyp"],
  "mentions": [],
  "author": {
    "id": "6808624114987697154",
    "username": "sky1760",
    "nickname": "Sky",
    "avatar": "https://p16-common-sign.tiktokcdn-us.com/...",
    "verified": false
  },
  "music": {
    "id": "7680374242605943583",
    "title": "Bow Bow Bow Zeddy Will x RaeSam",
    "author": "RaeSam",
    "play_url": "https://sf19.tiktokcdn-us.com/obj/ies-music-tx2/7685823574128593694.mp3",
    "duration": 21
  },
  "comments": [
    {
      "id": "7691799563662000909",
      "text": "It's ok stink I'll teach",
      "like_count": 8,
      "reply_count": 1,
      "create_time": 1790886682,
      "created_at": "2026-10-01 20:31:22",
      "author_username": "dauglyboyz",
      "author_nickname": "Keem",
      "author_avatar": "https://p16-common-sign.tiktokcdn-us.com/..."
    }
  ]
}
```

#### 📖 Output Field Documentation

**🔹 Video Identification**
| Field | Description |
|-------|-------------|
| `video_num` | Sequential video number |
| `hashtag` | Source hashtag used for scraping |
| `id` | TikTok video ID (unique) |
| `source_url` | Direct TikTok video URL |

**🔹 Video Metadata**
| Field | Description |
|-------|-------------|
| `title` | Video title/caption with hashtags |
| `duration` | Video length in seconds |
| `uploader` | Video uploader nickname |
| `video_url` | Direct CDN video download URL |
| `thumbnail` | High-quality video cover image |

**🔹 Engagement Metrics**
| Field | Description |
|-------|-------------|
| `like_count` | Total likes |
| `comment_count` | Total comments |
| `save_count` | Total saves |
| `share_count` | Total shares |
| `play_count` | Total video plays |

**🔹 Content Analysis**
| Field | Description |
|-------|-------------|
| `hashtags` | All hashtags from video title |
| `mentions` | All @mentions from video title |

**🔹 Author Information**
| Field | Description |
|-------|-------------|
| `author.id` | Author unique ID |
| `author.username` | Author TikTok handle |
| `author.nickname` | Author display name |
| `author.avatar` | Author profile picture URL |
| `author.verified` | Verification badge status |

**🔹 Music Information**
| Field | Description |
|-------|-------------|
| `music.id` | Music track ID |
| `music.title` | Music track title |
| `music.author` | Music artist name |
| `music.play_url` | Direct audio play URL |
| `music.duration` | Audio track duration |

**🔹 Comments Data (when enabled)**
| Field | Description |
|-------|-------------|
| `id` | Comment unique ID |
| `text` | Comment text content |
| `like_count` | Comment likes |
| `reply_count` | Comment replies |
| `create_time` | Comment timestamp (Unix) |
| `created_at` | Comment timestamp (formatted) |
| `author_username` | Commenter username |
| `author_nickname` | Commenter display name |
| `author_avatar` | Commenter profile picture |

***

### 🎨 Key Features of This TikTok Hashtag Scraper

#### 📊 Engagement Analytics

- **Complete Metrics** - Likes, comments, saves, shares, plays
- **Cross-Video Comparison** - Compare performance across hashtags
- **Trend Analysis** - Identify viral content patterns
- **Engagement Ratios** - Calculate interaction rates

#### 💬 Comment Intelligence

- **Comment Extraction** - Full comment text and metadata
- **Author Details** - Commenter profiles and avatars
- **Engagement Tracking** - Comment likes and replies
- **Timeline Analysis** - Comment creation timestamps

#### 🎵 Music & Audio Data

- **Track Information** - Music ID, title, and artist
- **Audio URLs** - Direct MP3 play links
- **Duration Detection** - Audio track length
- **Trending Sounds** - Discover popular audio tracks

#### 🎬 Complete Media Extraction

- **Video Download URLs** - Direct CDN links
- **High-Quality Thumbnails** - Video cover images
- **Author Avatars** - Profile pictures
- **Multiple URL Support** - Direct video scraping

#### 🚀 Performance Features

- **Multi-Hashtag Support** - Scrape multiple hashtags
- **Configurable Limits** - Control video and comment counts
- **Proxy Rotation** - Residential proxy support
- **Timestamp Tracking** - Precise timing data

***

### 💡 Use Cases for TikTok Hashtag Scraper

- **📈 Trend Analysis** - Track viral hashtag performance
- **📊 Content Strategy** - Analyze top-performing videos
- **🎭 Creator Research** - Study successful content patterns
- **💬 Sentiment Analysis** - Analyze comment engagement
- **🎵 Music Discovery** - Track trending sounds
- **🔬 Social Research** - Study social media dynamics
- **📱 Marketing Campaigns** - Identify hashtag opportunities
- **🎯 Competitive Analysis** - Benchmark against competitors

***

### ✨ Why Choose Our TikTok Hashtag Scraper?

- **⚡ Fast & Efficient** - Quick hashtag video extraction
- **🎯 100% Accurate** - Preserves all data without alteration
- **📦 Complete Data** - Everything from engagement to comments
- **🔄 Regular Updates** - Adapts to TikTok changes
- **🛡️ Production Ready** - Reliable with thousands of videos
- **💰 Cost Efficient** - Optimized for minimal compute time
- **🔒 Privacy Focused** - No personal data stored or shared

***

### ⚠️ Limitations

- Only works with public TikTok videos
- Private accounts are not accessible
- Comment scraping adds additional processing time
- Rate limits may apply for high-volume scraping
- Video URLs may expire after a certain period

***

### 📧 Need Custom Features for Your TikTok Hashtag Scraper?

Want **additional video fields**, **specific hashtag filters**, **custom output formats**, **advanced analytics**, or **automated reporting**?

✉️ Email **<codenest2.0@gmail.com>** for tailored enterprise solutions!

***

# Actor input Schema

## `hashtags` (type: `array`):

List of TikTok hashtags to scrape videos from (e.g. 'cat', '#dance', 'comedy' or TikTok tag URLs).

## `max_videos_per_hashtag` (type: `integer`):

Maximum number of videos to scrape per hashtag (up to 100+ videos supported via automatic pagination).

## `video_urls` (type: `array`):

List of TikTok video URLs or tag links (full/long URLs or short URLs).

## `proxy` (type: `object`):

Apify Proxy configuration. US Residential proxies are used by default to bypass blocks and IP restrictions.

## `max_comments` (type: `integer`):

Maximum number of comments to scrape per TikTok video when comments are enabled.

## `scrape_comments` (type: `boolean`):

Toggle ON to scrape and include video comments in the output. When turned OFF, comments will not be shown in the output.

## Actor input object example

```json
{
  "hashtags": [
    "cat"
  ],
  "max_videos_per_hashtag": 100,
  "proxy": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ],
    "apifyProxyCountry": "US"
  },
  "max_comments": 50,
  "scrape_comments": false
}
```

# Actor output Schema

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

Tabular overview of scraped TikTok videos with stats, direct links, and thumbnails.

## `commentsView` (type: `string`):

View of scraped video comments with author details and like counts.

## `allResults` (type: `string`):

Complete dataset containing all video metadata, stats, comments, and media links.

## `outputRecord` (type: `string`):

Consolidated JSON array of all scraped TikTok results stored in the default Key-Value Store.

# 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 = {
    "hashtags": [
        "cat"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("codenest/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 = { "hashtags": ["cat"] }

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

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

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

```

## CLI example

```bash
echo '{
  "hashtags": [
    "cat"
  ]
}' |
apify call codenest/tiktok-hashtag-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,codenest/tiktok-hashtag-scraper"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/z9u31ZBtZBbehXmDa/builds/3miTsFTBefhK9Evj7/openapi.json
