# Douban Scraper - Movies, TV, Books, Ratings & Reviews (`xiaolu_ling/douban-scraper`) Actor

Scrape Douban (豆瓣) movies, TV shows, books and music: ratings with star distribution, hot short comments, long reviews with full text, Top 250 and other charts. No login needed.

- **URL**: https://apify.com/xiaolu_ling/douban-scraper.md
- **Developed by:** [CN Data Lab](https://apify.com/xiaolu_ling) (community)
- **Categories:** Social media, Other
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$4.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.

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

## Douban Scraper - Movies, TV, Books, Ratings & Reviews

Get public data from [Douban](https://www.douban.com) (豆瓣), the main rating and review site for movies, TV shows, books and music in China. Use it to measure how Chinese audiences rate a title, to collect review text for sentiment analysis, or to build datasets.

No Douban account is needed. Field names are in English. Text content stays in the original language.

### What you can scrape

| Mode | Input | Output |
|---|---|---|
| **Details and ratings** | Subject URLs or IDs | Title, original title, year, rating, number of ratings, share of 1 to 5 stars, wish and done counts, genres, countries, directors, actors, authors, publisher, summary |
| **Hot short comments** | Subject URLs or IDs | Comment text, star rating, useful votes, date, author |
| **Long reviews** | Subject URLs or IDs | Title, abstract, optional full text, star rating, useful votes, comment count, date, author |
| **Charts** | Collection names | Ranked lists such as `movie_top250`, `movie_showing`, `movie_hot_gaia`, `tv_hot` |
| **Search** | Keywords | The top matching movies, TV shows, books and music |

### Input examples

Ratings of a movie, a book and an album:

```json
{
    "mode": "subject",
    "queries": [
        "https://movie.douban.com/subject/1292052/",
        "https://book.douban.com/subject/1084336/",
        "music:1401853"
    ]
}
```

Long reviews of a book with full text:

```json
{
    "mode": "reviews",
    "queries": ["book:1084336"],
    "maxItems": 100,
    "includeFullText": true
}
```

The Douban Top 250 movies:

```json
{
    "mode": "collection",
    "queries": ["movie_top250"],
    "maxItems": 250
}
```

### Output examples

Subject:

```json
{
    "type": "movie",
    "id": "1292052",
    "url": "https://movie.douban.com/subject/1292052/",
    "title": "肖申克的救赎",
    "originalTitle": "The Shawshank Redemption",
    "year": "1994",
    "rating": 9.7,
    "ratingCount": 3348990,
    "ratingDistribution": [0.0011, 0.001, 0.0136, 0.1302, 0.8541],
    "wishCount": 519960,
    "doneCount": 5751328,
    "shortCommentCount": 667929,
    "reviewCount": 14974,
    "genres": ["剧情", "犯罪"],
    "countries": ["美国"],
    "directors": ["弗兰克·德拉邦特"],
    "actors": ["蒂姆·罗宾斯", "摩根·弗里曼"]
}
```

`ratingDistribution` is the share of 1-star, 2-star, 3-star, 4-star and 5-star ratings.

Short comment:

```json
{
    "type": "comment",
    "commentId": "32514679",
    "subjectId": "1292052",
    "text": "恐惧让你沦为囚犯，希望让你重获自由。——《肖申克的救赎》",
    "rating": 5,
    "usefulCount": 26503,
    "createdAt": "2008-02-27 21:43:23",
    "authorName": "如小果",
    "authorLocation": "北京"
}
```

Review:

```json
{
    "type": "review",
    "reviewId": "1000104",
    "url": "https://book.douban.com/review/1000104/",
    "subjectId": "1084336",
    "title": "长大就笨了",
    "abstract": "那天我第一次打开《小王子》，就呆了。…",
    "rating": 5,
    "usefulCount": 5102,
    "commentCount": 445,
    "createdAt": "2005-04-06 11:51:52",
    "authorName": "大头绿豆"
}
```

### Limits you should know

Douban limits what visitors without login can see. The Actor returns what Douban gives to such visitors.

- **Short comments:** about the 100 to 200 hottest comments of a subject. Sorting by newest is not available.
- **Long reviews:** about the 200 hottest reviews of a subject.
- **Search:** only the top matches (1 to 10 subjects per keyword). For some keywords Douban returns matches without rating data. Use the details mode on the result URLs to get ratings.
- **Times** are in China Standard Time (UTC+8), as Douban shows them.

### Pricing

Pay per result. Each subject, comment, review or chart row in the dataset is one result. You do not pay for failed queries.

### FAQ

**How do I find the ID of a subject?**
It is the number in the URL. For `https://movie.douban.com/subject/1292052/` the ID is `1292052`. Bare IDs are read as movie or TV. For books and music use the URL, or `book:ID` and `music:ID`.

**Is it legal to scrape Douban?**
The Actor collects only data that is publicly visible without login. Results can contain personal data such as user names. Make sure that your use follows the law that applies to you.

**Something does not work or you need another field?**
Open an issue on the Issues tab.

# Actor input Schema

## `mode` (type: `string`):

Select the type of data. The meaning of "Queries" depends on this mode.

## `queries` (type: `array`):

Subject URLs (movie.douban.com, book.douban.com, music.douban.com), references such as book:1084336, or numeric movie/TV IDs. For charts: a collection name such as movie_top250, movie_showing, movie_hot_gaia or tv_hot. For search: keywords.

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

Maximum number of results for each query.

## `includeFullText` (type: `boolean`):

Applies to the reviews mode. Without it you get the title and a short abstract. Runs take longer.

## `proxyConfiguration` (type: `object`):

Proxy servers used for the requests.

## Actor input object example

```json
{
  "mode": "subject",
  "queries": [
    "https://movie.douban.com/subject/1292052/"
  ],
  "maxItems": 20,
  "includeFullText": false,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# Actor output Schema

## `results` (type: `string`):

All scraped items in the default dataset.

# 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 = {
    "mode": "subject",
    "queries": [
        "https://movie.douban.com/subject/1292052/"
    ],
    "maxItems": 20,
    "proxyConfiguration": {
        "useApifyProxy": true
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("xiaolu_ling/douban-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 = {
    "mode": "subject",
    "queries": ["https://movie.douban.com/subject/1292052/"],
    "maxItems": 20,
    "proxyConfiguration": { "useApifyProxy": True },
}

# Run the Actor and wait for it to finish
run = client.actor("xiaolu_ling/douban-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 '{
  "mode": "subject",
  "queries": [
    "https://movie.douban.com/subject/1292052/"
  ],
  "maxItems": 20,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}' |
apify call xiaolu_ling/douban-scraper --silent --output-dataset

```

## MCP server setup

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