# Telegram Channel Scraper — Public Posts, No Login (`teodor_banea/telegram-channel-scraper`) Actor

Scrape posts from public Telegram channels without an account, API key or bot. Text, views, dates, media URLs, reactions, polls, forwards and replies as clean rows, with date ranges and incremental runs.

- **URL**: https://apify.com/teodor_banea/telegram-channel-scraper.md
- **Developed by:** [Banea Teodor](https://apify.com/teodor_banea) (community)
- **Features:** Limited permissions
- **Stats:** 1 total users, 0 monthly users, 93.1% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $3.50 / 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

## Telegram Channel Scraper — Public Posts, No Login

Scrape posts from any **public Telegram channel** through Telegram's own web preview
(`https://t.me/s/channel`). No Telegram account, no API key, no bot token, no phone number —
and therefore nothing that can get banned. Paste channel names, get clean rows: text, date,
views, reactions, media URLs, link previews, polls, forwards and replies.

### What does Telegram Channel Scraper do?

For every channel you list, the Actor walks the public post history newest-first and returns
one row per post. You can cap the number of posts per channel, restrict the export to a date
window, or continue from the last message ID of a previous run — which makes it a cheap,
schedulable channel monitor. Channel metadata (title, description, subscriber count, media
counters) is stored for free alongside the posts.

### Why use this Actor?

- **No login, no keys, no bans.** It reads the same preview pages a logged-out browser sees.
  Private channels, invite links, bots and user profiles are reported honestly as "no public
  preview" instead of failing silently.
- **Date ranges and incremental runs.** Use `postedAfter` (absolute or relative, e.g. `1 day`)
  for daily schedules, or feed `newestMessageId` from the previous run back as `sinceMessageId`.
- **One clean, constant row shape.** Views as numbers, ISO dates, media URLs, reactions with
  counts, polls with percentages, forward and reply references, extracted hashtags, mentions and
  links. Fields a post does not have are `null` or empty, never missing — CSV and Sheets stay aligned.
- **Managed proxies.** Datacenter first, automatic escalation to residential if Telegram pushes back.
  Nothing to configure.
- **Honest reporting.** The run's status message says exactly why a channel came back short:
  history exhausted, date cutoff reached, no public preview, restricted by Telegram.

### How much does it cost?

**$2.50 per 1,000 posts.** No per-run fee, proxies and compute included.

| Run | Posts | Cost |
|---|---|---|
| Default input (2 channels × 50 posts) | 100 | $0.25 |
| Daily monitor, 5 channels, `postedAfter: "1 day"` (~20 posts/day each) | ~100 | ~$0.25/day |
| Full export, 1 channel, 5,000 posts | 5,000 | $12.50 |

Channel info records and error records are free.

### Input

| Field | Type | Description |
|---|---|---|
| `channels` | array | **Required.** Public channels as `@durov`, `durov`, `https://t.me/durov` or `https://t.me/s/durov`. Up to 100 per run. |
| `maxPostsPerChannel` | integer | Posts per channel, newest first. Default 100, max 10,000. |
| `maxTotalPosts` | integer | Optional cap across all channels. `0` (default) = no run-wide cap. |
| `postedAfter` | string | Only posts on or after this date: `YYYY-MM-DD` or relative (`3 days`, `2 weeks`). |
| `postedBefore` | string | Only posts on or before this date (`YYYY-MM-DD`). Newer posts are skipped page by page. |
| `sinceMessageId` | integer | Only posts with a message ID above this number. Use `newestMessageId` from the previous run's `CHANNELS` record. Applies to every channel in the run. |
| `includeChannelInfo` | boolean | Store channel title, description, avatar, counters and `newestMessageId` under the `CHANNELS` key (free). Default `true`. |
| `includeTextHtml` | boolean | Add `textHtml` with Telegram's formatting as HTML. Default `false`. |
| `includeServiceMessages` | boolean | Include service posts (photo changed, pinned…). Default `false`. |

Example input:

```json
{
    "channels": ["telegram", "@durov"],
    "maxPostsPerChannel": 50,
    "postedAfter": "7 days"
}
```

### Output

One row per post in the default dataset:

```json
{
    "messageId": 548,
    "channelUsername": "durov",
    "url": "https://t.me/durov/548",
    "channelTitle": "Pavel Durov",
    "channelSubscribers": 10500000,
    "text": "🤝 Telegram has become the sponsor of Codeforces — the largest competitive programming platform in the world.",
    "textHtml": null,
    "date": "2026-09-11T16:04:02.000Z",
    "views": 2100000,
    "isEdited": false,
    "authorSignature": "Pavel Durov",
    "isService": false,
    "isForwarded": false,
    "forwardedFromName": null,
    "forwardedFromUrl": null,
    "replyToMessageId": null,
    "replyToUrl": null,
    "replyToAuthor": null,
    "replyToText": null,
    "mediaType": "none",
    "photoUrls": [],
    "videoUrl": null,
    "videoThumbUrl": null,
    "videoDurationSeconds": null,
    "documentName": null,
    "documentSize": null,
    "linkPreviewUrl": "https://codeforces.com/blog/entry/156620",
    "linkPreviewSiteName": "Codeforces",
    "linkPreviewTitle": "Telegram Returns as Title Sponsor of Codeforces!",
    "linkPreviewDescription": "Hi, Codeforces!",
    "linkPreviewImageUrl": "https://cdn4.telesco.pe/file/buhmvGwl.jpg",
    "pollQuestion": null,
    "pollType": null,
    "pollOptions": [],
    "pollVotes": null,
    "reactions": [{ "emoji": "⭐", "count": 21400 }, { "emoji": "🔥", "count": 9800 }],
    "reactionsTotal": 31200,
    "mentions": [],
    "hashtags": [],
    "links": ["https://codeforces.com/blog/entry/156620"],
    "scrapedAt": "2026-10-08T14:30:00.000Z"
}
```

`mediaType` is one of `none`, `photo`, `album`, `video`, `roundVideo`, `document`, `audio`,
`voice`, `sticker`, `poll`, `location`, `unsupported`. Albums are one row with every photo in
`photoUrls`.

The `CHANNELS` record in the run's key-value store holds one entry per channel:

```json
{
    "username": "durov",
    "inputName": "durov",
    "url": "https://t.me/durov",
    "title": "Pavel Durov",
    "description": "Founder of Telegram.",
    "imageUrl": "https://cdn4.telesco.pe/file/avatar.jpg",
    "subscribers": 10500000,
    "photos": 102,
    "videos": 46,
    "files": null,
    "links": 200,
    "previewAvailable": true,
    "newestMessageId": 548,
    "oldestMessageIdScraped": 499,
    "messagesScraped": 50,
    "scrapedAt": "2026-10-08T14:30:00.000Z"
}
```

Channels that could not be scraped are listed under the `ERRORS` key with a reason
(`notFound`, `noPreview`, `restricted`, `requestFailed`).

### Tips and tricks

- **What has no public preview:** private channels, invite links (`t.me/+…`, `joinchat`),
  private supergroups (`t.me/c/…`), bots and user profiles. Those entries are rejected up front
  or reported in `ERRORS`; the other channels still run.
- **Incremental monitoring:** schedule the Actor with `postedAfter: "1 day"` for several channels,
  or with `sinceMessageId` for a single channel, and append the dataset to your sheet or database.
- **Old history:** `postedBefore` far in the past means the Actor pages through all newer posts
  first. Those pages cost time, not money — only returned posts are billed.
- **Rounded numbers:** Telegram shows large counts as `18.9M` or `9.71K`; `views`,
  `channelSubscribers` and reaction counts are those rounded figures.
- **Canonical usernames:** some channels have an alias (for example `breakingmash` → `mash`).
  Rows and the `CHANNELS` record carry the canonical username Telegram uses in post links;
  `CHANNELS.inputName` keeps the name you entered (lowercased, without `@` or the URL). Every
  requested channel gets a record, even one the run never reached because of `maxTotalPosts`.
- **`textHtml`** is Telegram's own markup: custom emoji come as `<tg-emoji>` elements with an
  image fallback, spoilers as `<tg-spoiler>`.
- **Videos:** the preview exposes a direct MP4 URL for small videos only; for larger ones
  `videoUrl` is `null` and `videoThumbUrl` is kept.
- **Keyword search across channels is not possible** without a Telegram account, and this Actor
  deliberately stays account-free.

### Integrations

Export the dataset as JSON, CSV or Excel from the Apify Console, or pull it through the API:

```
https://api.apify.com/v2/datasets/<datasetId>/items?format=csv
```

Connect the Actor to Google Sheets, Zapier, Make, Slack or a webhook with Apify integrations,
or call it from your own code with the Apify API client (JavaScript/Python) and schedule it to
run hourly or daily.

# Changelog

This Actor's version history is a separate document: https://apify.com/teodor_banea/telegram-channel-scraper/changelog.md

# Actor input Schema

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

Enter one channel per line: @durov, durov, https://t.me/durov or https://t.me/s/durov. Only public channels have a web preview — private channels, invite links (t.me/+…), bots and user profiles are reported as errors.

## `maxPostsPerChannel` (type: `integer`):

Stop after this many posts for each channel, newest first.

## `maxTotalPosts` (type: `integer`):

Optional cap across all channels combined. Leave at 0 for no run-wide cap (each channel still stops at the per-channel maximum).

## `postedAfter` (type: `string`):

Only include posts on or after this date. Use an absolute date (YYYY-MM-DD, UTC start of day) or a relative one such as "3 days" (= 3 days ago). Ideal for scheduled runs: "1 day" fetches yesterday's and today's posts.

## `postedBefore` (type: `string`):

Only include posts on or before this date (YYYY-MM-DD, UTC end of day). Posts newer than this are skipped page by page, so a date far in the past takes longer but does not cost more.

## `sinceMessageId` (type: `integer`):

Only include posts whose message ID is greater than this number. The ID is the number at the end of a post link (t.me/durov/450). Every run stores newestMessageId per channel in the CHANNELS record — feed it back here to fetch only new posts. The value applies to every channel in the run, so combine it with a single channel (use "Posted after" for multi-channel incremental runs).

## `includeChannelInfo` (type: `boolean`):

Store each channel's title, description, avatar, subscriber/photo/video/file/link counters and newest message ID under the CHANNELS key of the run's key-value store. Free — not billed.

## `includeTextHtml` (type: `boolean`):

Add the post text with Telegram's formatting (bold, links, spoilers, custom emoji) as HTML in the textHtml field, next to the plain text.

## `includeServiceMessages` (type: `boolean`):

Include service posts (channel created, photo changed, pinned message…) as rows. They have no media and are billed like any other post.

## Actor input object example

```json
{
  "channels": [
    "telegram",
    "durov"
  ],
  "maxPostsPerChannel": 50,
  "maxTotalPosts": 0,
  "includeChannelInfo": true,
  "includeTextHtml": false,
  "includeServiceMessages": false
}
```

# Actor output Schema

## `posts` (type: `string`):

Channel posts: text (plain and optional HTML), ISO date, views, reactions, media URLs, link previews, polls, forwards, replies, hashtags, mentions and links.

## `postsCsv` (type: `string`):

The same posts as a CSV download for spreadsheets.

## `channels` (type: `string`):

One record per channel: title, description, avatar, subscriber/photo/video/file/link counters, and newestMessageId to feed back as sinceMessageId for incremental runs. Free — not billed.

## `errors` (type: `string`):

Channels or pages that could not be scraped (not found, private, bot or user profile, restricted, or requests failed). Only present when something failed; the run's status message reports the shortfall per channel.

# 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": [
        "telegram",
        "durov"
    ],
    "maxPostsPerChannel": 50
};

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

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

```

## MCP server setup

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