# Telegram Channel Scraper (`backhoe/telegram-channel-scraper`) Actor

- **URL**: https://apify.com/backhoe/telegram-channel-scraper.md
- **Developed by:** [D](https://apify.com/backhoe) (community)
- **Categories:** Social media
- **Stats:** 75 total users, 2 monthly users, 100.0% runs succeeded, 1 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-usage

## 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 Channel Scraper

Scraper for Telegram channels via public interface `t.me/s/` with residential proxy rotation.

### Features

#### Channel Metadata

- Channel name
- Username (@channel)
- Channel description
- Avatar/photo URL
- Subscriber count
- Numeric channel ID
- Statistics: photos, videos, files, links

#### Post Data

- Post ID
- Author
- Message text
- Publication date and time
- View count
- Forwards from other channels
- Replies to posts
- Media: photos, videos (URLs)
- Links in text

### Input Parameters

```json
{
  "channels": [
    "telegram",
    "https://t.me/s/ShrikeNews",
    "shtuchka_intelekt"
  ],
  "max_posts": 100,
  "proxy_configuration": {
    "useApifyProxy": true,
    "apifyProxyGroups": ["RESIDENTIAL"]
  },
  "rotate_proxy_per_request": true
}
```

#### Parameters:

- **channels** (required): Array of Telegram channels to scrape. Accepts:
  - Username (e.g., `"telegram"`)
  - Full URL (e.g., `"https://t.me/ShrikeNews"`)
  - Public URL (e.g., `"https://t.me/s/channel"`)
- **max\_posts** (default: 100): Maximum number of posts to scrape **per channel**
- **proxy\_configuration** (default: RESIDENTIAL): Apify Proxy settings
  - By default uses residential proxy
- **rotate\_proxy\_per\_request** (default: true): Rotate proxy for each request

### Output Data

The actor returns an **array of channel objects**, one for each channel scraped. Each object contains:

- Channel metadata
- Array of posts (`last_posts`)

Example output (array with 2 channels):

```json
[
  {
    "url": "https://t.me/s/ShrikeNews",
    "channel_username": "ShrikeNews",
    "channel_id": 1505028797,
    "channel_title": "Shrike News",
    "channel_description": "News that I find interesting...",
    "subscribers": 94500,
    "photos_count": 12100,
    "videos_count": 4090,
    "last_posts": [
      {
        "channel": "ShrikeNews",
        "post_id": "26982",
        "author": "Shrike News",
        "text": "Don't get confused...",
        "datetime": "2025-12-03T19:25:46+00:00",
        "views": 39900,
        "photos": ["https://cdn4.telesco.pe/file/..."],
        "links": ["https://t.me/ShrikeNews/26981"]
      }
    ]
  },
  {
    "url": "https://t.me/s/telegram",
    "channel_username": "telegram",
    "channel_id": 1234567890,
    "channel_title": "Telegram",
    "subscribers": 500000,
    "last_posts": [...]
  }
]
```

### Memory Settings

**Recommended: 128 MB**

The actor is optimized for minimal memory usage. When running via CLI or API use:

```bash
apify run --memory-mbytes=128
```

### Usage

#### Via Apify Console

1. Open the actor in Apify Console
2. Enter channel list in `channels` field (e.g., `["telegram", "ShrikeNews"]`)
3. Configure other parameters as needed (residential proxy enabled by default)
4. Click Start

#### Via CLI

```bash
## Run locally
apify run --memory-mbytes=128

## Run on Apify platform
apify push
apify call <ACTOR_ID> --memory-mbytes=128
```

#### Via API

```python
from apify_client import ApifyClient

client = ApifyClient('YOUR_API_TOKEN')

run_input = {
    "channels": ["ShrikeNews", "telegram", "https://t.me/s/shtuchka_intelekt"],
    "max_posts": 50
}

run = client.actor('<ACTOR_ID>').call(
    run_input=run_input,
    memory_mbytes=128
)

## Get results
dataset = client.dataset(run["defaultDatasetId"])
items = dataset.list_items().items
```

### Key Features

- ✅ **Residential proxies by default** - bypasses blocking
- ✅ **Proxy rotation** - new IP for each request
- ✅ **Realistic headers** - mimics real browser
- ✅ **Complete data extraction** - all available content
- ✅ **Low memory footprint** - runs on 128 MB
- ✅ **Numeric channel ID extraction** - extracts real Telegram channel ID

### Limitations

- Scrapes only public channels
- Post limit determined by `max_posts` parameter
- Requires Apify Residential Proxy for stable operation

# Actor input Schema

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

List of channels to scrape - supports usernames, t.me links, or t.me/s links. Scrape unlimited channels for free! Perfect for bulk data collection, competitor analysis, and audience research.

## `max_posts` (type: `integer`):

Control how many posts to extract from each channel. Higher values = more historical data. Set to 100 for quick snapshots or 1000 for deep analysis. No extra charges for larger datasets!

## `proxy_configuration` (type: `object`):

Enable premium residential proxies for 99.9% success rate and zero blocking. Highly recommended for scraping multiple channels. Included free with Apify - no additional proxy costs!

## `rotate_proxy_per_request` (type: `boolean`):

Get a fresh IP for every HTTP request to maximize anonymity and avoid rate limits. Recommended for large-scale scraping. Free proxy rotation included!

## Actor input object example

```json
{
  "channels": [
    "telegram",
    "https://t.me/s/ShrikeNews",
    "shtuchka_intelekt"
  ],
  "max_posts": 100,
  "proxy_configuration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  },
  "rotate_proxy_per_request": true
}
```

# 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",
        "ShrikeNews"
    ],
    "max_posts": 100,
    "proxy_configuration": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ]
    },
    "rotate_proxy_per_request": true
};

// Run the Actor and wait for it to finish
const run = await client.actor("backhoe/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",
        "ShrikeNews",
    ],
    "max_posts": 100,
    "proxy_configuration": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
    },
    "rotate_proxy_per_request": True,
}

# Run the Actor and wait for it to finish
run = client.actor("backhoe/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",
    "ShrikeNews"
  ],
  "max_posts": 100,
  "proxy_configuration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  },
  "rotate_proxy_per_request": true
}' |
apify call backhoe/telegram-channel-scraper --silent --output-dataset

```

## MCP server setup

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