# Douyin Search Scraper (`cloudcharlestom/douyin-search-scraper`)

Using the keywords as input, scrape the relevant information of Douyin/抖音 videos, including: video url, user info, digg count, comment count, share count, collect count and music info.
抖音搜索爬虫，以关键词作为输入，从抖音视频中抓取相关的信息，包括：视频链接、用户信息、点赞数、评论数、分享数、收藏数以及音乐信息。

- **URL**: https://beta-securitybyobscurity.apify.com/cloudcharlestom/douyin-search-scraper.md
- **Developed by:** [CloudCharles](https://beta-securitybyobscurity.apify.com/cloudcharlestom) (community)
- **Categories:** Automation, News, Social media
- **Stats:** 14 total users, 8 monthly users, 100.0% runs succeeded, NaN bookmarks
- **User rating**: No ratings yet

## Pricing

$18.88/month + usage

To use this Actor, you pay a monthly rental fee to the developer. The rent is subtracted from your prepaid usage every month after the free trial period.
You also pay for the Apify platform usage, which gets cheaper the higher Apify subscription plan you have.

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

# README

### 一、What's this? 这是什么？

This is a tool for scraping data from Douyin. It enables you to conveniently obtain data from Douyin and can be used for your data analysis, business reports, information tracking, and integration into your applications. It can help you obtain the following data:

- Video information, such as video ID, title, cover url, download url, duration, creation time, digg count, comment count, collect count, share count, etc.
- User information about the video, such as user ID, nickname, user avatar, signature, etc.
- Music information about the video, such as music ID, title, author, album name, cover url, url, duration, etc.
- Sharing information about the video, such as sharing title, sharing description, sharing url, etc.
- HashTag information about the video, such as hashtag ID, hashtag name, etc.

这是一款抖音爬取工具，它可以为您方便的获取抖音上的数据，可用于您的数据分析、业务报告、信息追踪以及集成到您的应用程序，它可以帮助您获得如下数据：

- 视频信息，如视频ID、标题、封面URL、URL、时长、创建时间、播放量、评论量、点赞量、分享量等。
- 关于视频的用户信息，如用户ID、昵称、用户头像、签名等。
- 关于视频的音乐信息，如音乐ID、标题、作者、专辑名、封面URL、URL、时长等。
- 关于视频的分享信息，如分享标题、分享描述、分享URL等。
- 关于视频的标签信息，如标签ID、标签名等。

### 二、How to use? 如何使用？

- \[Register for a free Apify account.] (https://console.apify.com/sign-up)
- [Open Douyin Search Scraper](https://apify.com/cloudcharlestom/douyin-search-scraper)
- Enter the video keyword you want to search for, e.g. Today's Hot Topics.
- Click Start and wait for the data scraping to complete.
- Download your data in JSON， XML， CSV， Excel or HTML format.

中文：

- [免费注册一个Apify账户。](https://console.apify.com/sign-up)
- [打开 Douyin Search Scraper](https://apify.com/cloudcharlestom/douyin-search-scraper)
- 输入想要搜索的视频关键词，keyword，例如：今日热门。
- 点击开始并等待数据的爬取完成。
- 以 JSON、XML、CSV、Excel 或 HTML 格式下载您的数据。

### 三、Input & Output Struct 输入与输出

#### 1、Input 输入

- keyword: Video keyword, for example: Today's Hot Topics.
- count: The number of videos to be crawled, for example: 10.
- timeout: The maximum timeout period, in milliseconds, for example: 15000. If sufficient data cannot be retrieved within this time, it will return a timeout.

中文：

- keyword: 视频关键词，例如：今日热门。
- count: 要爬取的视频数量，例如：10。
- timeout: 最大的超时时间，毫秒，例如：15000，如果超过这个时间还不能抓取到足够的数据，则超时返回。

#### 2、Output Struct 输出的结构

```json
[
  {
    "id": "",
    "cover": "",
    "url": "",
    "desc": "",
    "author": {
      "id": "",
      "short_id": "",
      "nickname": "",
      "signature": "",
      "avatar_larger": "",
      "avatar_thumb": "",
      "avatar_medium": "",
      "aweme_count": 0,
      "following_count": 0,
      "follower_count": 0,
      "favoriting_count": 0,
      "total_favorited": 0
    },
    "music": {
      "id": "",
      "title": "",
      "author": "",
      "album": "",
      "cover_hd": "",
      "cover_large": "",
      "cover_medium": "",
      "cover_thumb": "",
      "play_url": "",
      "source_platform": 0,
      "duration": 0,
      "owner_id": ""
    },
    "video": {
      "format": "",
      "height": 3840,
      "width": 2160,
      "cover": "",
      "dynamic_cover": "",
      "origin_cover": "",
      "video_url": "",
      "download_url": "",
      "ratio": "720p",
      "duration": 31067,
      "cdn_url_expired": 0
    },
    "text_extra": [
      {
        "start": 0,
        "end": 0,
        "type": 1,
        "hashtag_name": "",
        "hashtag_id": "",
        "is_commerce": false,
        "caption_start": 0,
        "caption_end": 0
      },
      {
        "start": 0,
        "end": 0,
        "type": 1,
        "hashtag_name": "",
        "hashtag_id": "",
        "is_commerce": false,
        "caption_start": 0,
        "caption_end": 0
      },
      {
        "start": 0,
        "end": 0,
        "type": 1,
        "hashtag_name": "",
        "hashtag_id": "",
        "is_commerce": false,
        "caption_start": 0,
        "caption_end": 0
      }
    ],
    "statistics": {
      "aweme_id": "",
      "comment_count": 1,
      "digg_count": 44,
      "download_count": 2,
      "play_count": 0,
      "share_count": 50,
      "forward_count": 0,
      "lose_count": 0,
      "lose_comment_count": 0,
      "whatsapp_share_count": 0,
      "digest": "",
      "exposure_count": 0,
      "live_watch_count": 0,
      "collect_count": 9,
      "recommend_count": 3
    },
    "share_info": {
      "share_url": "",
      "share_weibo_desc": "",
      "share_desc": "",
      "share_title": "",
      "bool_persist": 0,
      "share_title_myself": "",
      "share_title_other": "",
      "share_link_desc": "",
      "share_signature_url": "",
      "share_signature_desc": "",
      "share_quote": "",
      "share_desc_info": ""
    },
    "create_time": 1701091143
  }
]
```

### 四、How to use the crawled data? 如何使用爬取到的数据？

- Monitor the current hotspots in the real-time monitoring industry and predict the trends of content (such as beauty, games, education).
- Analyze user behavior data, such as video views, likes, comments, etc., to understand user preferences.
- Integrate data for social media analysis, such as user interactions, content dissemination, etc.
- Based on the obtained data, you can think of more scenarios.

中文：

- 实时监控行业热点，预测内容趋势（如美妆、游戏、教育）。
- 分析用户行为数据，如视频观看量、点赞数、评论数等，了解用户偏好。
- 整合数据进行社交媒体分析，如用户互动、内容传播等。
- 基于获取到的数据，您能想到的更多场景。

### 五、Application integration and expansion 应用程序集成与扩展

This is due to the integration capabilities provided by the Apify platform. You can integrate the obtained data with other applications, including the following:
这得益于Apify平台提供的集成能力，您可以将获取到的数据与其他应用程序进行集成，包括如下：

- [Instagram](https://docs.apify.com/platform/integrations/make/instagram)
- [TikTok](https://docs.apify.com/platform/integrations/make/tiktok)
- [Facebook](https://docs.apify.com/platform/integrations/make/facebook)
- [Telegram](https://docs.apify.com/platform/integrations/telegram)
- [Slack](https://docs.apify.com/platform/integrations/slack)
- [and more](https://docs.apify.com/platform/integrations)

### 六、Feedback 问题反馈

We will always iterate its functions, including launching new features and fixing known bugs. If you encounter any problems during use, please create an issue in the Issues section in a timely manner, and we will follow up and solve it promptly.

我们始终会迭代它的功能，包括推出新功能和修复已知的Bug，如果您在使用过程中遇到了任何问题，请及时在Issues中创建问题，我们将及时跟进解决。

### 七、Q\&A 常见问题

#### 1、Is data crawling legal? 爬取数据是否合法？

Our Actor adheres to ethical standards and does not extract any private user data, such as email addresses, gender or location. It will only extract the publicly available data on the platform and will not extract non-public private data. However, you should be aware that your results may contain publicly available user data. Personal data is protected by the General Data Protection Regulation (GDPR) of the European Union and other laws and regulations around the world. Please do not use the data for illegal purposes. If you are unsure whether the usage scenario is legal, please consult your lawyer.

我们的Actor符合道德规范，不会提取任何私人用户数据，例如电子邮件地址、性别或位置。它只会提取平台公开的数据，不会提取非公开的隐私数据。但是，您应该注意，您的结果可能包含公开的用户数据。个人数据受欧盟《通用数据保护条例》（GDPR）以及世界各地其他法律法规的保护。请勿将数据用于非法用途，如果您不确定使用的场景是否合法，请咨询您的律师。

# Actor input Schema

## `keyword` (type: `string`):

The keywords of the search / 搜索的关键词

## `count` (type: `integer`):

Number of data entries / 数据条数

## `timeout` (type: `integer`):

Maximum timeout time, unit: milliseconds / 最大超时时间，单位毫秒

## Actor input object example

```json
{
  "count": 10,
  "timeout": 15000
}
```

# 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 = {};

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

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

```

## MCP server setup

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

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Douyin Search Scraper",
        "description": "Using the keywords as input, scrape the relevant information of Douyin/抖音 videos, including: video url, user info, digg count, comment count, share count, collect count and music info.\n抖音搜索爬虫，以关键词作为输入，从抖音视频中抓取相关的信息，包括：视频链接、用户信息、点赞数、评论数、分享数、收藏数以及音乐信息。",
        "version": "0.0",
        "x-build-id": "9hJeJL9zD3NtMpOlc"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/cloudcharlestom~douyin-search-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-cloudcharlestom-douyin-search-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/cloudcharlestom~douyin-search-scraper/runs": {
            "post": {
                "operationId": "runs-sync-cloudcharlestom-douyin-search-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/cloudcharlestom~douyin-search-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-cloudcharlestom-douyin-search-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "keyword"
                ],
                "properties": {
                    "keyword": {
                        "title": "keyword",
                        "maxLength": 50,
                        "type": "string",
                        "description": "The keywords of the search / 搜索的关键词"
                    },
                    "count": {
                        "title": "count",
                        "maximum": 50,
                        "type": "integer",
                        "description": "Number of data entries / 数据条数",
                        "default": 10
                    },
                    "timeout": {
                        "title": "timeout",
                        "maximum": 30000,
                        "type": "integer",
                        "description": "Maximum timeout time, unit: milliseconds / 最大超时时间，单位毫秒",
                        "default": 15000
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
