# Huya Video Scraper (`natanielsantos/huya-video-scraper`) Actor

Extract detailed data about videos from the Huya (虎牙直播) platform. Scrape video details using direct video URLs, profile URLs, listing URLs, or search terms, allowing you to gather comprehensive data on a wide range of videos available on Huya.

- **URL**: https://apify.com/natanielsantos/huya-video-scraper.md
- **Developed by:** [Nataniel Santos](https://apify.com/natanielsantos) (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 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#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

## Huya Video Scraper

Extract detailed information about videos from the Huya platform. This Apify Actor can scrape video details using direct video URLs, profile URLs, listing URLs, or search terms, allowing you to gather comprehensive data on a wide range of videos available on Huya.

### ✨ Features

- 🔎 Scrape by search terms, profiles, listings, or video URLs
- ⚡ Fast and reliable scraping
- 🧑‍💻 Perfect for non-technical users
- 🔒 No need for authentication
- 🔄 Automatically handles retries for failed requests
- 📦 Outputs data in JSON format for easy integration with other tools
- 🎬 Supports multiple video quality levels (360P, 720P, 1080P)

### 🎯 Who Is This For?

- Content creators and marketers looking to analyze Huya video content
- Researchers studying trends and patterns in online video content
- Developers needing structured data from Huya for their applications
- Anyone interested in gathering insights from Huya's vast video library

### ⬇️ Input Options

#### 🔗 URLs to Scrape

- **`urls`** (optional) - List of URLs to scrape. Can be:
  - Video URLs: `https://www.huya.com/video/play/1115457256.html`
  - Profile URLs: `https://www.huya.com/video/u/1199568157971`
  - Listing URLs: `https://www.huya.com/video/cat/51`

#### 🔍 Search Terms

- **`searchTerms`** (optional) - Search terms to query on Huya. The Actor will search for each term and scrape results until it reaches the `maxItemsPerUrl` limit.

#### ⚙️ Scraping Options

- **`maxItemsPerUrl`** (optional) - Maximum number of items to scrape per profile URL, listing URL, or search term. Default is `100`.
- **`profileSortBy`** (optional) - Sorting order for profile videos. Options: `latest`, `popular`. Default is `latest`.

#### 💡 Input Examples

##### 🔗 Scrape by Video URL

```json
{
  "urls": [
    "https://www.huya.com/video/play/1115457256.html"
  ]
}
```

##### 🔗 Scrape by Profile URL

```json
{
  "urls": [
    "https://www.huya.com/video/u/1199568157971"
  ],
  "maxItemsPerUrl": 50,
  "profileSortBy": "popular"
}
```

##### 🔗 Scrape by Listing URL

```json
{
  "urls": [
    "https://www.huya.com/video/cat/51"
  ],
  "maxItemsPerUrl": 25
}
```

##### 🔍 Scrape by Search Terms

```json
{
  "searchTerms": [
    "dance",
    "music",
    "gaming"
  ],
  "maxItemsPerUrl": 50
}
```

### 📤 Output Format

The scraper returns detailed video information including metadata, media properties, and engagement metrics.

#### Output Fields

- **`id`** - Unique identifier for the video
- **`uid`** - User ID of the video uploader
- **`title`** - Title of the video
- **`description`** - Description of the video
- **`url`** - URL of the video on Huya
- **`coverUrl`** - URL of the video's cover/thumbnail image
- **`authorName`** - Display name of the uploader
- **`authorAvatarUrl`** - URL of the uploader's avatar image
- **`category`** - Category of the video (e.g., "主播舞蹈", "Dance")
- **`duration`** - Duration of the video in seconds
- **`uploadTime`** - Timestamp of when the video was uploaded
- **`playCount`** - Total number of plays/views
- **`commentCount`** - Number of comments on the video
- **`favorCount`** - Number of times the video was favorited
- **`browseCount`** - Number of times the video was viewed in listings
- **`shareCount`** - Number of times the video was shared
- **`channel`** - Video channel/category
- **`playInfo`** - Array of available video quality options with URLs. Available quality definitions: `360P`, `720P`, `1080P`
- **`position`** - Position of the video in the listing or search results

### 🗂️ Output Example

```json
{
  "id": 1120061472,
  "uid": 1199665265343,
  "title": "屁股摇",
  "description": "舞蹈",
  "url": "https://www.huya.com/video/play/1120061472.html",
  "coverUrl": "https://v-huya-img2.msstatic.com/transfer/2631/1120061472/104.jpg",
  "authorName": "纯欲少女风",
  "authorAvatarUrl": "https://huyaimg.msstatic.com/avatar/1054/d9/9b6f60586ab819752a0458955a03d1_180_135.jpg",
  "category": "主播舞蹈",
  "duration": 9,
  "uploadTime": "2026-07-30 14:33:49",
  "playCount": 307870,
  "commentCount": 33,
  "favorCount": 1745,
  "browseCount": 2863,
  "shareCount": 53,
  "channel": "Dance",
  "playInfo": [
    {
      "size": 1575479,
      "width": 576,
      "height": 1098,
      "definition": "1080P",
      "url": "http://videotx-platform.cdn.huya.com/leaf/1048585/...",
      "m3u8Url": "http://videotx-platform.cdn.huya.com/leaf/1048585/..."
    },
    {
      "size": 1575479,
      "width": 576,
      "height": 1098,
      "definition": "720P",
      "url": "http://videotx-platform.cdn.huya.com/leaf/1048585/...",
      "m3u8Url": "http://videotx-platform.cdn.huya.com/leaf/1048585/..."
    },
    {
      "size": 565327,
      "width": 336,
      "height": 640,
      "definition": "360P",
      "url": "http://videotx-platform.cdn.huya.com/leaf/1048585/...",
      "m3u8Url": "http://videotx-platform.cdn.huya.com/leaf/1048585/..."
    }
  ],
  "position": 1
}
```

### 💲 How much will scraping Youku cost you?

The pricing changes according to your Apify plan.

Plan | Pricing
\--- | ---
Free | $5/1000 videos
Starter | $3.5/1000 videos
Scale | $3/1000 videos
Business | $2.8/1000 videos

💡 Note: As a free user, you are limited to extracting a maximum of 50 items per run and only the first 5 URLs will be processed.

### 🧩 Integrations and Huya Video Scraper

Huya Video Scraper can be connected with almost any cloud service or web app thanks to [integrations on the Apify platform](https://apify.com/integrations). You can integrate with Make, Zapier, Slack, Airbyte, GitHub, Google Sheets, Google Drive, [and more](https://docs.apify.com/integrations). Or you can use [webhooks](https://docs.apify.com/integrations/webhooks) to carry out an action whenever an event occurs, e.g. get a notification whenever Huya Video Scraper successfully finishes a run.

### 🔌 Using Huya Video Scraper with the Apify API

The Apify API gives you programmatic access to the Apify platform. The API is organized around RESTful HTTP endpoints that enable you to manage, schedule, and run Apify actors. The API also lets you access any datasets, monitor actor performance, fetch results, create and update versions, and more.

To access the API using Node.js, use the `apify-client` NPM package. To access the API using Python, use the `apify-client` PyPI package.

Check out the [Apify API reference](https://docs.apify.com/api/v2) docs for full details or click on the  [API tab](https://apify.com/natanielsantos/huya-video-scraper/api) for code examples.

### 💬 Giving feedback

We're always working on improving the performance of our Actors. So if you've got any technical feedback for Huya Video Scraper or simply found a bug, please create an issue on the Actor's [Issues tab](https://apify.com/natanielsantos/huya-video-scraper/issues/open) in Apify Console.
📧 Email: nathan.santos159@hotmail.com

# Actor input Schema

## `maxItemsPerUrl` (type: `integer`):

The maximum number of videos to scrape from each profile, listing, or search term.

## `urls` (type: `array`):

List of Huya video URLs to scrape data from. Examples:

- https://www.huya.com/video/play/1115457256.html (**Video URL**)
- https://www.huya.com/video/u/1199568157971 (**Profile URL**)
- https://www.huya.com/video/cat/51 (**Listing URL**)

## `profileSortBy` (type: `string`):

The sorting order for profile videos.

## `searchTerms` (type: `array`):

List of search terms to find videos on Huya.

## Actor input object example

```json
{
  "maxItemsPerUrl": 100,
  "urls": [
    "https://www.huya.com/video/u/1199568157971",
    "https://www.huya.com/video/cat/51",
    "https://www.huya.com/video/play/1115457256.html"
  ],
  "profileSortBy": "latest"
}
```

# Actor output Schema

## `results` (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 = {
    "urls": [
        "https://www.huya.com/video/play/1067414286.html"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("natanielsantos/huya-video-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 = { "urls": ["https://www.huya.com/video/play/1067414286.html"] }

# Run the Actor and wait for it to finish
run = client.actor("natanielsantos/huya-video-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 '{
  "urls": [
    "https://www.huya.com/video/play/1067414286.html"
  ]
}' |
apify call natanielsantos/huya-video-scraper --silent --output-dataset

```

## MCP server setup

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