# Tianyancha Company News Scraper (`spider_studio/tianyancha-news`) Actor

Scrape paginated Tianyancha company news by gid, including articles, media sources, summaries, sentiment, publication times, and original URLs. Combine with Search, Basic Info, Shareholders, Risk, Dynamics, and Listing Actors for media monitoring, due diligence, and alerts.

- **URL**: https://apify.com/spider_studio/tianyancha-news.md
- **Developed by:** [Tarique](https://apify.com/spider_studio) (community)
- **Categories:** Automation, E-commerce, News
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.00 / 1,000 news articles

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

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

### What does **tianyancha-news** do?

**tianyancha-news** is a paginated **Chinese company news and media monitoring scraper**. Given a company `gid`, it extracts articles from [Tianyancha](https://www.tianyancha.com/) with their title, source website, summary, sentiment, publication time, and original URL as structured JSON.

Each article becomes a dataset row tagged with company ID, and pagination supports hundreds of articles per company. Run it in Apify Console or automate media alerts through the Apify API, schedules, webhooks, monitoring, and integrations.

### Why use **tianyancha-news**?

- **No browser, no manual login** — plain HTTP requests, so runs are fast and cheap.
- **Clean structured JSON** — every article is flattened into its own dataset row, downloadable as JSON, CSV, Excel, XML, or HTML.
- **Paginated** — control page size and page count to tune volume versus cost.
- **Ready for automation** — combine it with Apify **scheduling**, **webhooks**, and **API access** to power media-monitoring and reputation pipelines.
- **Apify platform advantages** — monitored runs, pay-per-use billing, proxy support, and 15 integrations out of the box.

### Related Tianyancha Actors

These Actors share a `gid`-based workflow. Start with [Tianyancha Company Search](https://apify.com/spider_studio/tianyancha-search) to find companies by keyword, then pass each returned `id` to the detail Actors below.

| Actor | Best for |
|-------|-----------------|
| [Tianyancha Company Search](https://apify.com/spider_studio/tianyancha-search) | Find companies by keyword and return reusable `gid` values |
| [Tianyancha Basic Company Info](https://apify.com/spider_studio/tianyancha-basic-info) | Company profile, legal representative, capital, credit code, and address |
| [Tianyancha Shareholders](https://apify.com/spider_studio/tianyancha-shareholders) | Shareholders, holding percentages, controlling shareholder, and actual controller |
| [Tianyancha Company Dynamics](https://apify.com/spider_studio/tianyancha-dynamics) | Company changes, lawsuits, court hearings, penalties, and alerts |
| [Tianyancha Risk & IP Counts](https://apify.com/spider_studio/tianyancha-dimension) | Lawsuit, penalty, patent, trademark, branch, and risk counts |
| [Tianyancha Listed Company Data](https://apify.com/spider_studio/tianyancha-listing) | Stock code, exchange, market board, listing status, and market cap |

### How to use **tianyancha-news**

1. Open the Actor's **Input** tab in the Apify Console.
2. Enter one or more company `gids` (e.g. `[9519792, 9519793]`).
3. Optionally set **Articles per page** and **Max pages per company**.
4. Click **Start**. The Actor fetches each company's news and stores every article in the run's dataset.
5. Open the run's **Dataset** tab to preview the JSON, or download it in your preferred format.

You can also run it from the command line with the Apify CLI:

```bash
apify call <username>/tianyancha-news --input '{"gids": [9519792, 9519793], "pageSize": 20, "maxPages": 1}'
```

### Input

The Actor takes the following input fields:

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `gids` | array\<integer> | Yes | Tianyancha company group IDs (gids) to fetch, e.g. `[9519792, 9519793]` |
| `pageSize` | integer | No | Articles per page (1–100, default `20`) |
| `maxPages` | integer | No | Max pages per company (1–50, default `1`) |

Example input:

```json
{
  "gids": [9519792, 9519793],
  "pageSize": 20,
  "maxPages": 2
}
```

All Tianyancha API requests use **Apify Residential Proxy** with the exit
location fixed to mainland China (`CN`). No custom proxy URL or proxy environment
variable is required. The Actor fails instead of falling back to a direct request.

The remaining runtime option is preset in the Actor configuration:

| Variable | Description |
|----------|-------------|
| `TYC_CONCURRENCY` | Maximum number of companies fetched concurrently. Preset and fallback: `8`. |

### Output

The Actor pushes one record per news article to the default dataset. A representative (abbreviated) output item looks like:

```json
{
  "gid": 9519792,
  "pageNum": 1,
  "total": 5000,
  "title": "A common challenge most smartphone users encounter",
  "website": "Example News",
  "sentiment": "Neutral",
  "rtm": 1786855325000,
  "uri": "https://www.toutiao.com/article/7674485073693131266/"
}
```

You can download the dataset in various formats such as JSON, HTML, CSV, or Excel.

### Data table

Main fields you can expect in the output:

| Field | Description |
|-------|-------------|
| `gid` | Tianyancha company ID |
| `title` | News article title |
| `abstracts` | News article summary |
| `website` | Source website or media outlet |
| `sentiment` | Sentiment label (positive, neutral, or negative) |
| `rtm` | Publish time (millisecond timestamp) |
| `uri` | Original article URL |
| `total` | Total articles available for the company |

### How much does it cost to scrape Tianyancha?

This Actor uses **pay-per-event pricing at $0.001 per successfully saved news article**.

| Successfully saved news articles | Event charge |
|----------------------------------|--------------|
| 1 | $0.001 |
| 10 | $0.010 |
| 100 | $0.100 |
| 1,000 | $1.000 |

Each news article is charged only when its record is successfully saved to the Dataset. Failed requests, restricted/error responses, Dataset write failures, invalid entries, and valid company lookups with zero articles are not charged an event fee. Duplicate input `gid` values are normalized and processed only once. Apify platform usage, including compute, residential proxy traffic, storage, and data transfer, is billed separately.

### Tips or Advanced options

- **Get the right `gid`** — pair this with the `tianyancha-search` Actor to find companies by keyword, then feed their `id`s here.
- **Tune volume** — set `maxPages: 1` and a small `pageSize` for a quick sample, or raise both to pull a company's full news history.
- **Fast and cheap** — the Actor uses plain HTTP, so it is far cheaper and faster than browser-based scrapers for the same data.

### FAQ, disclaimers, and support

- **Is this legal?** The Actor accesses Tianyancha's public mobile API. You are responsible for complying with Tianyancha's Terms of Service and applicable laws, and for how you use the data.
- **Known limitations** — the private API may change without notice; if the endpoint changes, runs may fail until the Actor is updated.
- **Need a custom solution?** For tailored scraping, bulk export, or integration work, open an issue on the **Issues** tab or reach out for a custom Actor.

This page was generated with [Apify's Actor README guidelines](https://docs.apify.com/platform/actors/development/actor-guides/actor-readme).

# Actor input Schema

## `gids` (type: `array`):

Tianyancha company group IDs (gids) whose news to fetch, e.g. \[9519792, 9519793].

## `pageSize` (type: `integer`):

Number of news articles returned per page (1-100). Default 20.

## `maxPages` (type: `integer`):

Maximum number of pages to fetch per company (1-50). Default 1 (a single page of pageSize articles).

## Actor input object example

```json
{
  "gids": [
    9519792
  ],
  "pageSize": 20,
  "maxPages": 1
}
```

# Actor output Schema

## `dataset` (type: `string`):

Dataset containing the news articles for each requested gid.

# 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 = {
    "gids": [
        9519792
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("spider_studio/tianyancha-news").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 = { "gids": [9519792] }

# Run the Actor and wait for it to finish
run = client.actor("spider_studio/tianyancha-news").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 '{
  "gids": [
    9519792
  ]
}' |
apify call spider_studio/tianyancha-news --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,spider_studio/tianyancha-news"
        }
    }
}
```

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/PB373zWREW3cZsISN/builds/g1mPzfvrmqN0jGTYZ/openapi.json
