# Telegram 頻道爬蟲｜公開頻道訊息、瀏覽數、輿情一鍵匯出（免 API） (`claude_code_reviewer/telegram-channel-scraper`) Actor

免登入抓 Telegram 公開頻道：最新訊息、瀏覽數、發布時間、媒體旗標與外部連結，含關鍵字過濾與增量抓取。輸出 JSON／CSV／Excel。品牌監控、社群輿情、頻道分析必備。

- **URL**: https://apify.com/claude\_code\_reviewer/telegram-channel-scraper.md
- **Developed by:** [Chad](https://apify.com/claude_code_reviewer) (community)
- **Categories:** Social media, News, Automation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 1,000 頻道訊息

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?

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

## Telegram 頻道爬蟲｜公開頻道訊息、瀏覽數、輿情一鍵匯出（免 API）

抓 Telegram **公開**頻道的網頁預覽（`t.me/s/{channel}`）：訊息文字、瀏覽數、轉發標記、媒體與連結旗標，走純 HTML 端點，不用登入、不用 bot token。

### 輸出欄位

| 欄位名稱 | 型別 | 說明 |
|---------|------|------|
| message\_id | string | 訊息 ID（頻道內遞增） |
| channel | string | 頻道 username（讀自頁面本身的 `data-post`） |
| channel\_title | string | null | 頻道顯示名稱 |
| text | string | null | 訊息文字（純媒體訊息無文字時為 null；`<br>` 換行已轉成空格，避免段落黏在一起） |
| created\_at | string | null | 發布時間（ISO 8601 UTC） |
| views | number | null | 瀏覽數（原始頁面可能是 "12.6M"／"1.51M"／"895" 這種格式，已轉換成整數） |
| author | string | null | 署名作者（多數頻道以頻道身分發文，此欄位為 null；少數頻道每則訊息會顯示發文人） |
| is\_forwarded | boolean | 是否為轉發訊息 |
| forwarded\_from | string | null | 轉發來源頻道／使用者名稱（非轉發時為 null） |
| has\_media | boolean | 是否含媒體（照片／影片／檔案／語音／圓形影片任一） |
| media\_type | string | null | `photo` | `video` | `document` | `voice` | `roundvideo` | null |
| has\_link\_preview | boolean | 是否含連結預覽卡片 |
| links | string\[] | 訊息文字內的外部連結（已去重） |
| is\_reply | boolean | 是否為回覆訊息 |
| message\_url | string | 訊息連結（`https://t.me/{channel}/{message_id}`） |
| source\_mode | string | 固定 `channel` |
| source\_query | string | 查詢時輸入的頻道 username |
| scraped\_at | string | 抓取時間（ISO 8601） |

### 輸入欄位

| 欄位 | 型別 | 預設 | 說明 |
|-----|------|------|------|
| channels | array | `["durov"]` | 頻道 username 或 t.me 網址，例如 `durov` 或 `https://t.me/durov`（也接受 `https://t.me/s/durov`）。只支援公開頻道，私人／邀請連結（joinchat、+）不支援 |
| bulkInput | textarea | — | 批量貼上，一行一個，執行時自動併入 channels |
| keywords | array | — | 訊息文字關鍵字過濾（不分大小寫，留空不過濾） |
| maxItems | integer | 50 | 每個頻道最多抓幾則訊息。上限 2000 |
| dateFrom | string | — | 依訊息發布時間過濾。格式 `3d`、`12h`、`2w`（相對時間）或 `MM/DD/YY`（絕對日期）。有設定時會提早停止翻頁，排程監控更省成本 |
| proxyConfiguration | proxy | Apify datacenter proxy | 預設開啟；不用 proxy 會與其他 run 共用出口 IP 而被限流。自備 proxy 或本機測試才關 |

> 這個 Actor 只有一種模式（抓頻道訊息），所以輸入欄位沒有 `mode` 選擇器——`channels` 直接是主要欄位，介面更單純。

### 輸入範例

#### 抓單一頻道最新訊息

```json
{
  "channels": ["durov"],
  "maxItems": 30
}
```

#### 關鍵字監控 + 時間區間（排程用）

```json
{
  "channels": ["telegram"],
  "keywords": ["update", "feature"],
  "dateFrom": "7d",
  "maxItems": 200
}
```

### 品牌與關鍵字監控

設定 `keywords` + `dateFrom`，排程每天跑一次，就是一套零維護的公開頻道輿情/品牌監控：只拿到新訊息裡符合關鍵字的部分，省成本也省後製篩選的力氣。想要更完整的社群輿情拼圖？搭配作者的其他繁中社群 actor：Threads（`threads-feed-scraper`）、LIHKG（`lihkg-scraper`，香港論壇）。三隻 actor 輸出欄位同一套慣例（snake\_case、缺值 null、附 ISO 時間戳、`keywords`/`dateFrom` 篩選語法相同），方便合併分析多平台輿情。

### 注意事項

- 只抓**公開**頻道的網頁預覽版本，不需要帳號、不需要 bot token、不需要加入頻道
- 私人頻道、邀請連結（`joinchat/...`、`t.me/+...`）不支援：這類連結沒有對應的公開預覽頁，Actor 會在 log 顯示警告並略過該筆輸入
- 媒體內容（照片／影片／檔案／語音）**不會下載**，只會標記 `has_media`／`media_type` 這類旗標，`links` 欄位也只收錄訊息文字裡的外部連結，不含媒體檔案網址
- `views` 在原始頁面常以 "12.6M"／"1.51M"／"895" 這種格式呈現，已統一轉換成整數
- 訊息文字用 `<br>` 換行時已轉換成空格，避免段落黏成一團無法閱讀
- 連續 2 頁沒有新訊息會自動停止翻頁，不空轉燒費用；設了 `dateFrom` 的話，整頁訊息都比 `dateFrom` 舊就會直接停止（更省成本）
- Telegram 網頁預覽版本未來若改版，判斷方式：以 Apify cloud smoke test 結果為準（go/no-go）

### 常見問題（FAQ）

**Q: 怎麼找頻道 username？**

A: 在 Telegram App 裡打開頻道，頻道資訊頁會顯示 `@username`；或直接看頻道分享連結 `https://t.me/{username}`。把 `@` 去掉貼進 `channels` 就可以，或整段網址貼上也行，Actor 會自動抽出 username。

**Q: 私人頻道可以嗎？**

A: 不行。這個 Actor 只走 Telegram 官方提供的公開網頁預覽（`t.me/s/{channel}`），私人頻道沒有這個頁面，貼邀請連結（`joinchat`／`+`）會被自動略過並在 log 顯示警告，不會被計費。

**Q: `author` 欄位為什麼常常是 null？**

A: 多數頻道是以「頻道」身分發文，不會顯示個別發文人；只有少數頻道（多半是使用群組管理身分發文，或是個人頻道如本 README 範例的 durov）每則訊息才會顯示署名，這類頻道的 `author` 會有值。誠實回傳 null，不做假資料。

**Q: 可以同時抓多個頻道嗎？**

A: 可以。在 `channels` 填多個 username，或用 `bulkInput` 一行一個貼上。

### 免責聲明

本工具僅供學術研究及合法商業分析用途。使用者應遵守 Telegram 服務條款及相關法規。請勿以本工具進行任何侵害他人隱私、散布虛假資訊或其他違法行為。作者不對任何濫用行為承擔責任。

***

Telegram 爬蟲、Telegram channel scraper、頻道訊息、公開頻道、社群輿情、品牌監控、message monitoring

# Actor input Schema

## `channels` (type: `array`):

頻道 username 或 t.me 網址，例如 durov 或 https://t.me/durov（也接受 https://t.me/s/durov）。只支援**公開**頻道，私人／邀請連結（joinchat、+）不支援，會被略過並在 log 顯示警告。

## `bulkInput` (type: `string`):

**一行一個**頻道 username 或網址，按 Enter 換行，不要加引號或逗號。執行時自動併入上面的頻道欄位，從 Google Sheet / Excel 複製一整欄貼進來最快。

## `keywords` (type: `array`):

（選填）只保留訊息文字包含任一關鍵字的項目（不分大小寫）。留空表示不過濾。媒體純圖無文字的訊息在有設定關鍵字時會被過濾掉。

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

每個頻道最多抓幾則訊息。上限 2000。

## `dateFrom` (type: `string`):

依訊息發布時間判斷。格式：相對時間 3d（3 天內）、12h（12 小時內）、2w（2 週內），或絕對日期 MM/DD/YY。留空表示不過濾。有設定時會提早停止翻頁，排程監控時省成本。

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

預設走 Apify datacenter proxy：不用 proxy 時會跟平台上其他 run 共用出口 IP，容易被 Telegram 限流（429、缺頁）。HTML 回應不大，proxy 流量費可忽略。自備 proxy 或本機測試才關掉。

## Actor input object example

```json
{
  "channels": [
    "durov"
  ],
  "maxItems": 50,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# Actor output Schema

## `dataset` (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 = {
    "channels": [
        "durov"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("claude_code_reviewer/telegram-channel-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 = { "channels": ["durov"] }

# Run the Actor and wait for it to finish
run = client.actor("claude_code_reviewer/telegram-channel-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 '{
  "channels": [
    "durov"
  ]
}' |
apify call claude_code_reviewer/telegram-channel-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,claude_code_reviewer/telegram-channel-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/OBB45EqST7Mz1B6ww/builds/Lz2yraEe5gt5N7WHf/openapi.json
