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

Extract all videos with hashtag from Tiktok, including detail, ads, metrics, music, hashtags and video label. Easily collect and analyze user-generated content, and download results in formats like JSON, CSV, or Excel.

- **URL**: https://apify.com/apibox/tiktok-hashtag-scraper.md
- **Developed by:** [ApiBox](https://apify.com/apibox) (community)
- **Categories:** Social media
- **Stats:** 150 total users, 1 monthly users, 100.0% runs succeeded, 7 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

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

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

#### 📖 What is Tiktok?

TikTok is the world's leading destination for short-form mobile videos. [🔗](https://www.tiktok.com/about)

#### ❓ What is Tiktok Hashtag Scraper?

Tiktok Hashtag Scraper is a data extraction tool created for scraping all posts with hashtag from Tiktok.

#### ⚡ How do I use Tiktok Hashtag Scraper?

1. Create an [Apify](https://www.apify.com?fpr=hs6s8) account

2. Open [Tiktok Hashtag Scraper](https://apify.com/apibox/tiktok-hashtag-scraper?fpr=hs6s8)

3. Add Input parameters

4. Click the “Start” button and wait for the data to be extracted.
   Download your data in JSON, XML, CSV, Excel, or HTML

#### ⬇️ Input parameters

The input of this scraper should be JSON containing the list of pages that should be visited. Check the input tab for detailed list.

##### Input Example

```json
{
	"hashtag": "trending",
	"num": 100
}
```

#### ⬆️ Output

You can download the resulting dataset in various formats such as JSON, HTML, CSV or Excel. The structure of each post detail looks like this:

##### Output Examplee

```json
{
  "author": "cvlsx",
  "authorAvatar": "https://p16-sign-sg.tiktokcdn.com/aweme/100x100/tos-alisg-avt-0068/b803632231aae3b7fca28741f991aa1b.jpeg?lk3s=a5d48078&nonce=41580&refresh_token=2c5d2fedd0eb726f3bc29a375d4a7bca&x-expires=1723194000&x-signature=4gz4Bg3cKrGQt05SQwY9dsbNHvk%3D&shp=a5d48078&shcp=b59d6b55",
  "id": "7358054695576947984",
  "desc": "what makes you think i’m not gonna be doing this for all pictures🧋🤨 #photoideas #poseideas #phototrend #tutorials #photoediting ",
  "cover": "https://p16-sign-sg.tiktokcdn.com/obj/tos-alisg-p-0037/77d6d28da5a94f398271c334a23ddc1c_1713180622?lk3s=b59d6b55&nonce=61434&refresh_token=d6c3b46ca967b8ed4c4466892eebe34e&x-expires=1723194000&x-signature=9ZjV35sDbellUZ5yQMDjmBjQZvI%3D&shp=b59d6b55&shcp=-",
  "duration": 17,
  "isAd": true,
  "format": "mp4",
  "ratio": "540p",
  "height": 1024,
  "width": 576,
  "collectCount": 64300,
  "commentCount": 674,
  "diggCount": 387200,
  "playCount": 4400000,
  "shareCount": 20000,
  "diversificationId": 10082,
  "diversification": "Photography",
  "music": "SWEET I THOUGHT YOU WANTED TO DANCE",
  "musicId": "6977600106329606918",
  "isOriginalMusic": false,
  "hashtags": [
    "photoideas",
    "poseideas",
    "phototrend",
    "tutorials",
    "photoediting"
  ],
  "createTime": "2024-04-15 11:30:20",
  "createTimestamp": 1713180620,
  "url": "https://www.tiktok.com/@cvlsx/video/7358054695576947984"
}
```

#### 🔗 Integrations

You can use [Make](https://www.make.com/en/register?pc=apibox) to integrate this scraper to any other SaaS platform by designing your own automation flows.

#### 📬 Contact

We value your feedback and are here to assist you with any questions or concerns you may have. Feel free to reach out to us through the following email
apiboxguru@gmail.com

# Actor input Schema

## `hashtag` (type: `string`):

The hashtag you want to get the data from

## `num` (type: `integer`):

Maximum number of videos that you want to scrape

## Actor input object example

```json
{
  "hashtag": "trending",
  "num": 100
}
```

# 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 = {
    "hashtag": "trending"
};

// Run the Actor and wait for it to finish
const run = await client.actor("apibox/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 = { "hashtag": "trending" }

# Run the Actor and wait for it to finish
run = client.actor("apibox/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 '{
  "hashtag": "trending"
}' |
apify call apibox/tiktok-hashtag-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,apibox/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/F17MEF8Lb2fHU1tVa/builds/Xf0iMBaJupa1fQoEf/openapi.json
