# TGStat Channel Analytics Scraper (`automation-lab/tgstat-channel-analytics-scraper`) Actor

Extract public TGStat channel analytics, subscriber trends, and recent Telegram post metrics from TGStat channel pages.

- **URL**: https://apify.com/automation-lab/tgstat-channel-analytics-scraper.md
- **Developed by:** [Stas Persiianenko](https://apify.com/automation-lab) (community)
- **Categories:** Social media, Lead generation
- **Stats:** 3 total users, 2 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per event

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use 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

## TGStat Channel Analytics Scraper

Extract public TGStat channel analytics and recent Telegram post metrics from server-rendered TGStat pages.

### What does TGStat Channel Analytics Scraper do?

TGStat Channel Analytics Scraper turns public TGStat channel pages into clean datasets.

It accepts TGStat URLs, Telegram links, or `@handle` values.

It saves channel identity, subscriber metrics, growth trend data, and recent post engagement.

Use it when you need repeatable exports instead of manually opening TGStat pages.

### Who is it for?

- 📣 Social listening teams tracking Telegram channels.
- 📈 Influencer marketers comparing channel audience quality.
- 🧲 Lead generation teams building Telegram prospect lists.
- 📰 PR teams monitoring owned, competitor, and media channels.
- 🛒 Channel buyers checking audience size before sponsorship deals.
- 🧪 Researchers collecting public channel engagement indicators.

### Why use it?

Manual TGStat checks are slow.

Screenshots are hard to compare.

Copy-pasted metrics break dashboards.

This actor creates structured rows you can filter, join, and export.

### What data can it extract?

| Field | Description |
| --- | --- |
| `itemType` | `channel`, `recent_post`, or `popular_post` |
| `channelHandle` | Telegram handle such as `@durov` |
| `channelTitle` | Channel title from TGStat metadata |
| `description` | Public TGStat description/about text |
| `avatarUrl` | Preview image or channel avatar URL |
| `subscribers` | Subscriber count parsed as a number |
| `subscriberTrend30d` | Difference between first and last chart point |
| `subscriberTrend30dPercent` | 30-day trend as a percentage |
| `rankText` | Ranking text when TGStat exposes it |
| `category` | Category link text when visible |
| `postId` | TGStat/Telegram post identifier |
| `publishedAt` | Visible post date text |
| `text` | HTML-stripped post text |
| `views` | Post view count |
| `forwards` | Public share/forward count where visible |
| `replies` | Reply/comment count where visible |
| `reactions` | Reaction count where visible |
| `postUrl` | TGStat post URL |
| `telegramPostUrl` | Telegram post URL |
| `scrapedAt` | ISO timestamp for the scrape |

### How much does it cost to scrape TGStat channel analytics?

The actor uses pay-per-event pricing.

- A small run start fee covers setup.
- Each saved channel, post, or popular-post row is charged as one result.
- The default result price is designed for lightweight HTTP scraping.

For example, scraping one channel with 10 recent posts usually produces about 11 rows.

### Input

You can provide:

- TGStat channel URLs, for example `https://tgstat.com/channel/@durov`.
- Telegram links, for example `https://t.me/durov`.
- Handles, for example `@durov` or `durov`.

### Input example

```json
{
  "startUrls": [
    { "url": "https://tgstat.com/channel/@durov" }
  ],
  "channelHandles": ["@telegram"],
  "maxPostsPerChannel": 10,
  "includePopularPosts": true,
  "maxItems": 25
}
````

### Output example

```json
{
  "itemType": "recent_post",
  "channelHandle": "@durov",
  "channelTitle": "Pavel Durov",
  "subscribers": 11313704,
  "postId": "520",
  "publishedAt": "23 May, 16:26",
  "text": "Post text...",
  "views": 2500000,
  "postUrl": "https://tgstat.com/channel/@durov/520"
}
```

### How to scrape a TGStat channel

1. Open the actor input page.
2. Paste one or more TGStat URLs or Telegram handles.
3. Keep `maxPostsPerChannel` low for your first test.
4. Run the actor.
5. Export the dataset as JSON, CSV, Excel, or through the API.

### Best practices

- Start with 1-3 channels to verify the fields you need.
- Increase `maxPostsPerChannel` after confirming output quality.
- Use `maxItems` as a spend guard for large batches.
- Re-run the same channel list on a schedule to track subscriber changes.
- Keep your own historical snapshots for trend dashboards.

### Integrations

You can send output to:

- Google Sheets for channel monitoring.
- Airtable for influencer CRM workflows.
- BI tools for engagement dashboards.
- Webhooks for automated alerts.
- Apify datasets for downstream actors.

### API usage with Node.js

```js
import { ApifyClient } from 'apify-client';

const client = new ApifyClient({ token: process.env.APIFY_TOKEN });
const run = await client.actor('automation-lab/tgstat-channel-analytics-scraper').call({
  startUrls: [{ url: 'https://tgstat.com/channel/@durov' }],
  maxPostsPerChannel: 10,
  maxItems: 25
});
console.log(run.defaultDatasetId);
```

### API usage with Python

```python
from apify_client import ApifyClient

client = ApifyClient('MY-APIFY-TOKEN')
run = client.actor('automation-lab/tgstat-channel-analytics-scraper').call(run_input={
    'channelHandles': ['@durov'],
    'maxPostsPerChannel': 10,
    'maxItems': 25,
})
print(run['defaultDatasetId'])
```

### API usage with cURL

```bash
curl -X POST 'https://api.apify.com/v2/acts/automation-lab~tgstat-channel-analytics-scraper/runs?token=MY-APIFY-TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"channelHandles":["@durov"],"maxPostsPerChannel":10,"maxItems":25}'
```

### MCP usage

Use the Apify MCP server from Claude Code or Claude Desktop:

`https://mcp.apify.com/?tools=automation-lab/tgstat-channel-analytics-scraper`

Claude Code setup:

```bash
claude mcp add apify-tgstat https://mcp.apify.com/?tools=automation-lab/tgstat-channel-analytics-scraper
```

Claude Desktop JSON config:

```json
{
  "mcpServers": {
    "apify-tgstat": {
      "url": "https://mcp.apify.com/?tools=automation-lab/tgstat-channel-analytics-scraper"
    }
  }
}
```

Example prompts:

- "Scrape TGStat analytics for @durov and summarize subscriber growth."
- "Compare recent post views for these Telegram channels."
- "Export TGStat channel metrics to a table I can paste into Sheets."

### Scheduling

Schedule the actor daily or weekly to build historical channel snapshots.

A daily run can show audience growth, post frequency, and engagement movement.

A weekly run is often enough for influencer discovery and sponsorship planning.

### Data quality notes

TGStat may format large numbers as `k` or `m`.

The actor converts compact numbers to integers where possible.

Some metrics may be missing on a channel or post.

Missing public metrics are returned as `null` instead of guessed values.

### Troubleshooting: no results

Check that the channel has a public TGStat page.

Private Telegram channels may not appear on TGStat.

Try a known public handle such as `@durov` to verify your setup.

### Troubleshooting: fewer posts than requested

TGStat may show fewer recent posts in the initial public HTML.

The actor extracts posts visible in the server-rendered page.

Increase limits only after checking that TGStat exposes more rows for that channel.

### Legality

This actor extracts publicly visible TGStat pages.

Do not scrape private, restricted, or personal data you are not allowed to process.

Review TGStat terms, Telegram policies, and your local regulations before using output commercially.

### Related scrapers

Other automation-lab actors can complement this one:

- `https://apify.com/automation-lab/telegram-scraper` for broader Telegram content workflows.
- `https://apify.com/automation-lab/social-media-scrapers` for cross-platform monitoring.
- `https://apify.com/automation-lab/rss-feed-scraper` for content tracking.

### FAQ

#### Does this actor log in to Telegram?

No. It scrapes public TGStat pages and does not require Telegram credentials.

#### Does it use a browser?

No. TGStat channel pages are server-rendered, so the actor uses lightweight HTTP requests.

#### Can I scrape many channels?

Yes. Add multiple URLs or handles and set `maxItems` high enough for the expected output rows.

#### Can I get historical subscriber changes?

The actor extracts the subscriber chart points visible in TGStat HTML and calculates a 30-day trend when available.

#### Why are some reaction counts null?

TGStat does not always expose every engagement metric for every post in the initial HTML.

#### Can I use it for influencer marketing?

Yes. Subscriber counts, growth trends, and post views help compare potential sponsorship channels.

### Changelog

- 0.1.0: Initial TGStat channel analytics scraper with channel summary, recent posts, and popular post links.

### Support

If TGStat changes its HTML and output looks incomplete, open an Apify issue with the channel URL and run ID.

The maintainer can update selectors based on the failing page.

# Actor input Schema

## `startUrls` (type: `array`):

Public TGStat channel URLs, t.me channel links, or handles. Examples: https://tgstat.com/channel/@durov, https://t.me/durov, @durov.

## `channelHandles` (type: `array`):

Optional additional Telegram channel handles. Use @handle or handle, one per row.

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

Maximum number of recent post rows to save for each channel.

## `includePopularPosts` (type: `boolean`):

Save popular-in-channel post links when TGStat shows them in the sidebar.

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

Safety cap for all saved rows across channel summary, recent posts, and popular post rows.

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://tgstat.com/channel/@durov"
    }
  ],
  "channelHandles": [
    "@telegram"
  ],
  "maxPostsPerChannel": 10,
  "includePopularPosts": true,
  "maxItems": 20
}
```

# Actor output Schema

## `overview` (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 = {
    "startUrls": [
        {
            "url": "https://tgstat.com/channel/@durov"
        }
    ],
    "channelHandles": [
        "@telegram"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("automation-lab/tgstat-channel-analytics-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 = {
    "startUrls": [{ "url": "https://tgstat.com/channel/@durov" }],
    "channelHandles": ["@telegram"],
}

# Run the Actor and wait for it to finish
run = client.actor("automation-lab/tgstat-channel-analytics-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "startUrls": [
    {
      "url": "https://tgstat.com/channel/@durov"
    }
  ],
  "channelHandles": [
    "@telegram"
  ]
}' |
apify call automation-lab/tgstat-channel-analytics-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=automation-lab/tgstat-channel-analytics-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "TGStat Channel Analytics Scraper",
        "description": "Extract public TGStat channel analytics, subscriber trends, and recent Telegram post metrics from TGStat channel pages.",
        "version": "0.1",
        "x-build-id": "7AGrYpG7ibVjUXXkF"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/automation-lab~tgstat-channel-analytics-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-automation-lab-tgstat-channel-analytics-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/automation-lab~tgstat-channel-analytics-scraper/runs": {
            "post": {
                "operationId": "runs-sync-automation-lab-tgstat-channel-analytics-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/automation-lab~tgstat-channel-analytics-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-automation-lab-tgstat-channel-analytics-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "properties": {
                    "startUrls": {
                        "title": "TGStat or Telegram channel URLs",
                        "type": "array",
                        "description": "Public TGStat channel URLs, t.me channel links, or handles. Examples: https://tgstat.com/channel/@durov, https://t.me/durov, @durov.",
                        "items": {
                            "type": "object",
                            "required": [
                                "url"
                            ],
                            "properties": {
                                "url": {
                                    "type": "string",
                                    "title": "URL of a web page",
                                    "format": "uri"
                                }
                            }
                        }
                    },
                    "channelHandles": {
                        "title": "Telegram handles",
                        "type": "array",
                        "description": "Optional additional Telegram channel handles. Use @handle or handle, one per row.",
                        "default": [],
                        "items": {
                            "type": "string"
                        }
                    },
                    "maxPostsPerChannel": {
                        "title": "Recent posts per channel",
                        "minimum": 0,
                        "maximum": 100,
                        "type": "integer",
                        "description": "Maximum number of recent post rows to save for each channel.",
                        "default": 10
                    },
                    "includePopularPosts": {
                        "title": "Include popular post links",
                        "type": "boolean",
                        "description": "Save popular-in-channel post links when TGStat shows them in the sidebar.",
                        "default": true
                    },
                    "maxItems": {
                        "title": "Maximum dataset rows",
                        "minimum": 1,
                        "maximum": 10000,
                        "type": "integer",
                        "description": "Safety cap for all saved rows across channel summary, recent posts, and popular post rows.",
                        "default": 20
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
