# Fang.com New Homes Scraper - China Real Estate Listings (`bovi/fang-scraper`) Actor

Collect new-home project records from Fang.com’s public catalog. Get project names, locations, sale status, prices, ratings, tags, and project URLs. Run with city codes and maxResults; no login required. Pricing: $0.00295 per dataset item and $0.00005 per Actor Start event on the Free plan.

- **URL**: https://apify.com/bovi/fang-scraper.md
- **Developed by:** [Vitalii Bondarev](https://apify.com/bovi) (community)
- **Categories:** Real estate, Lead generation
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.95 / 1,000 fang.com new homes scraper - china real estate listings

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

## Fang.com New Homes Scraper

Scrape Fang.com’s public new-home project catalog and collect one JSON record per project for selected cities, without a Fang.com login. On the Free plan, each dataset item costs $0.00295.

- Collect one JSON record per project from Fang.com’s public new-home catalog.
- Monitor new-build prices by city and district.
- Research China’s primary housing market using listing values as shown on Fang.com.
- Compare projects using sale status, ratings, review counts, tags, and highlights.

### What you get

The Actor returns one dataset item for each project record it collects. Values remain in the language and format shown by Fang.com. A field is `null` when Fang.com does not provide the value; array fields are empty when no values are parsed.

| Field | Type | What it contains | Example |
|---|---|---|---|
| `id` | string | Fang.com project ID (`newcode`) | `1010204703` |
| `title` | string | Project name | `保利·京华曜` |
| `url` | string | Project page on `m.fang.com` | `https://m.fang.com/xf/bj/1010204703.html` |
| `city_name` | string | City name shown by Fang.com; can be `null` when not provided | `北京` |
| `city_code` | string | City code supplied in the input | `bj` |
| `district` | string | District; can be `null` when not provided | `丰台` |
| `business_area` | string | Business area or neighbourhood inside the district; can be `null` when not provided | `null` |
| `sale_status` | string | Sale status such as 在售, 待售, or 售完; can be `null` when no status is parsed | `待售` |
| `price` | number | Listed numeric price; `null` when the project price is to be determined or no numeric price is available | `null` |
| `price_unit` | string | Price unit, such as 元/平 or 万元/套起; can be `null` when no unit is parsed | `null` |
| `price_text` | string | Price text as displayed, including `价格待定`; can be `null` when no price text is parsed | `价格待定` |
| `nearby_price_text` | string | Surrounding-area price shown when the project price is to be determined; can be `null` when not provided | `null` |
| `rating` | number | Fang.com user rating out of 10; can be `null` when no rating is shown | `9.68` |
| `review_count` | integer | Number of Fang.com user reviews; can be `null` when no review count is shown | `3` |
| `tags` | array of strings | Property type and feature tags; empty when no tags are parsed | `["普通住宅", "二至三环", "地铁沿线", "改善优选"]` |
| `badges` | array of strings | Image badges such as 现房; empty when no badges are parsed | `[]` |
| `highlights` | array of strings | Ranking badges and offers; empty when none are parsed | `["免费专车，随时看房", "北京热门榜第1名"]` |
| `image_url` | string | Project cover image URL; can be `null` when no image is found | `https://loupanw.soufunimg.com/viewimage/housepic/20260925/40a1e521-7986-4dfc-89fd-30cd26edc875/224x168c.jpg?t=1` |
| `list_page` | integer | List page where the project was found | `1` |
| `source` | string | Source identifier | `fang.com` |
| `scraped_at` | ISO 8601 string | UTC timestamp for the collected record | `2026-11-02T00:42:51.896490+00:00` |

### Sample output

This sample is a price-to-be-determined project, so `price` and `price_unit` are `null`; the numeric price fields are filled for projects with a listed price.

```json
{
  "id": "1010204703", "title": "保利·京华曜",
  "url": "https://m.fang.com/xf/bj/1010204703.html",
  "city_name": "北京", "district": "丰台", "business_area": null,
  "sale_status": "待售",
  "tags": ["普通住宅", "二至三环", "地铁沿线", "改善优选"],
  "badges": [],
  "price": null, "price_unit": null, "price_text": "价格待定",
  "nearby_price_text": null,
  "rating": 9.68, "review_count": 3,
  "highlights": ["免费专车，随时看房", "北京热门榜第1名"],
  "image_url": "https://loupanw.soufunimg.com/viewimage/housepic/20260925/40a1e521-7986-4dfc-89fd-30cd26edc875/224x168c.jpg?t=1",
  "source": "fang.com", "city_code": "bj", "list_page": 1,
  "scraped_at": "2026-11-02T00:42:51.896490+00:00"
}
```

### Pricing

This Actor uses pay-per-event billing. The prices below are Free-plan prices. You pay only for the events listed below; platform usage of your runs (compute, proxy traffic and storage) is not billed to you separately.

| Charge event | Billing unit | Free-plan price | Condition |
|---|---|---:|---|
| `apify-actor-start` (Actor Start) | One event per GB of run memory, minimum one event | $0.00005 per event on the Free plan | Charged when the Actor starts; one event per GB of run memory, with a minimum of one event |
| `apify-default-dataset-item` (Dataset item) | One event for one scraped result with all fields | $0.00295 per event on the Free plan | Charged for each project record written to the dataset |

On the Free plan, 1,000 dataset items cost $2.95 and 10,000 dataset items cost $29.50. The Apify Free plan includes $5 of monthly platform usage credit. On the Free plan, 1,694 x $0.00295 = $4.9973 total for dataset items, plus $0.00005 for one start event, which gives $4.99735 total. This holds only with exactly one start event; run with one result to see how many start events your memory setting is charged.

### How to use

1. **Enter** one or more Fang.com city codes in `cities`, such as `bj`, `sh`, `gz`, `sz`, `hz`, `cd`, `nanjing`, or `wuhan`. Cities are processed in the order provided.
2. **Set** `maxResults` to limit the total number of project records collected across the selected cities.
3. **Configure** `proxyConfiguration` if you want to change the proxy; `useApifyProxy: false` runs without one.
4. **Start** the Actor. It requests Fang.com’s mobile new-home list pages and writes project records to the dataset until the result limit or available pages are reached. It reads at most 500 list pages per city, and a page with fewer than 20 items ends that city.
5. **Repeat** the run through Apify Schedules, using daily as a starting point for listing or price monitoring.

```json
{
  "cities": ["bj", "sh"],
  "maxResults": 100,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

Export the dataset as JSON or CSV, or read it through the Apify dataset API.

### Input parameters

| Parameter | What it does | Default |
|---|---|---|
| `cities` | Required. Fang.com city codes to scrape, processed in order until `maxResults` is reached. | `["bj"]` |
| `maxResults` | Maximum number of new-home projects to collect across all cities. Minimum 1. | `50` |
| `proxyConfiguration` | Optional proxy configuration used when `useApifyProxy` is true. | `{"useApifyProxy": true, "apifyProxyGroups": ["RESIDENTIAL"]}` |

### Limits and edge cases

| Condition | What you see | What to do |
|---|---|---|
| `maxResults` is reached | The Actor stops collecting and does not continue to later cities. | Increase `maxResults` and run again if you need more records. |
| A city code returns HTTP 404 | The city produces no records, and processing moves to the next city. | Check the city code against Fang.com and run again with a valid code. |
| A fetched page contains no projects | Pagination stops for that city. | Check the city code and retry the run if the result is unexpected. |
| A page contains no new project IDs | Pagination stops for that city. | Run again if the source page appears incomplete. |
| Fang.com serves a captcha, or a fetch still fails after 4 attempts | That city is skipped with a log warning, and the run can return fewer records or none. The proxy, enabled by default, helps larger runs. | Keep `useApifyProxy` set to `true` and run again, or split the cities across smaller runs. |
| A city has more than 500 list pages | The Actor stops that city at 500 pages. | Use `maxResults` to size the run within that bound. |
| A project has a duplicate ID in the run | The duplicate is skipped, so the dataset can contain fewer records than the requested maximum. | Review the dataset and rerun if necessary. |
| A project price is still to be determined | `price` and `price_unit` can be `null`; `price_text` can show `价格待定`, and `nearby_price_text` can contain the surrounding-area price when available. | Use `price_text` and `nearby_price_text` alongside the numeric price fields. |

### FAQ

#### How much does it cost to scrape Fang.com new homes?

On the Free plan, $0.00295 per dataset item plus $0.00005 per Actor Start event; the Pricing table has the details.

#### Why did my run return fewer projects than `maxResults`?

The selected city may have reached the end of its catalog, a page may have contained no new project IDs, or duplicate project IDs may have been skipped. Check the run log and city codes, then retry with a valid city list or a larger result limit.

#### Why is the numeric price null?

Fang.com can show a project as `价格待定`; see the `price_text` and `nearby_price_text` rows in What you get.

#### Is using Fang.com public listing data legal or allowed?

The Actor extracts public listing data from Fang.com and preserves values as shown on that source. Whether a particular use is legal or allowed depends on your use case, Fang.com’s source terms, and applicable law; review those requirements before using the data.

### Related actors

- [4zida.rs Scraper - Serbia Property Listings](https://apify.com/bovi/4zida-scraper) — related property-listing data for Serbia.
- [Aruodas.lt Property Listings Scraper](https://apify.com/bovi/aruodas-scraper) — related property-listing data for Lithuania.
- [At Home Japan Rental Listings](https://apify.com/bovi/athome-scraper) — related real-estate listing data for Japan.

### Usage statistics

This Actor creates a small, content-free summary at the end of each run, used only to monitor reliability and improve this Actor. No input values, credentials or scraped data are sent.

A copy of the exact record for your run is saved as `USAGE_STATS` in your own Apify key-value store.

To opt out, set `disableUsageStats` to `true` in the input. Nothing is sent then.

[Full list of collected fields](https://api.apify.com/v2/key-value-stores/v9rgHjMKLDGtHf8tD/records/index.html)

# Actor input Schema

## `cities` (type: `array`):

Fang.com city codes (the sub-domain of the city site), e.g. "bj" (Beijing), "sh" (Shanghai), "gz" (Guangzhou), "sz" (Shenzhen), "hz" (Hangzhou), "cd" (Chengdu), "wuhan", "nanjing". Cities are scraped in order until Max results is reached.

## `maxResults` (type: `integer`):

Maximum number of new-home projects to collect across all cities.

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

Optional proxy. fang.com shows a captcha after a burst of requests from one IP; a proxy (rotated per request) helps on larger runs.

## Actor input object example

```json
{
  "cities": [
    "bj"
  ],
  "maxResults": 50,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}
```

# Actor output Schema

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

Dataset with the scraped records.

# 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 = {
    "cities": [
        "bj"
    ],
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ]
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("bovi/fang-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 = {
    "cities": ["bj"],
    "proxyConfiguration": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
    },
}

# Run the Actor and wait for it to finish
run = client.actor("bovi/fang-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 '{
  "cities": [
    "bj"
  ],
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}' |
apify call bovi/fang-scraper --silent --output-dataset

```

## MCP server setup

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