# Twitch Streams Scraper Gql (`real-estate-api/twitch-streams-scraper-gql`) Actor

Twitch Streams Scraper GQL is a Python tool to extract stream titles, game categories, live viewer counts, streamer usernames, and uptime timestamps from Twitch's internal GraphQL endpoint. It exports structured live-streaming datasets into clean CSV or JSON formats

- **URL**: https://apify.com/real-estate-api/twitch-streams-scraper-gql.md
- **Developed by:** [real-estate-api](https://apify.com/real-estate-api) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.99 / 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.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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

### Twitch Streams Scraper (GQL) — Live Twitch Streams and Viewer Statistics

![Twitch Streams Scraper (GQL) cover](https://images.bigibyte.com/cdn-cgi/image/width=1260,height=540,fit=cover,format=webp/apify-actors-covers/twitch-streams-scraper-gql-cover.png)

### Overview

Twitch Streams Scraper (GQL) collects publicly available live stream information from Twitch and organizes it into a structured dataset. Capture stream IDs, titles, viewer counts, broadcaster details, and game categories without manually browsing Twitch's live directory.

Export the collected data in JSON, CSV, Excel, and other supported Apify dataset formats.

### Features

- **Live Stream Collection:** Retrieve live streams from Twitch's directory.
- **Top Streams:** Collect streams sorted by viewer count.
- **Game Filtering:** Filter results by game or category name.
- **Broadcaster Details:** Capture broadcaster login and display names.
- **Viewer Statistics:** Collect the current viewer count for each stream.
- **Maximum Item Control:** Set a limit on the number of records collected.
- **Structured Dataset:** Store stream information in a clean, organized format.
- **Scheduled Runs:** Refresh live stream data using Apify schedules.

### Collection Mode

| Mode | Description |
|---|---|
| `topStreams` | Collect live streams sorted by viewer count, up to the configured `maxItems` limit. |

The actor typically retrieves up to 30 streams per page. Twitch may restrict requests for subsequent pages, so a run can return fewer records than the requested maximum.

### Input Parameters

| Parameter | Type | Description |
|---|---|---|
| `mode` | String | Collection mode. Use `topStreams`. |
| `first` | Integer | Number of streams requested per page. |
| `gameName` | String | Optional game or category name used to filter results. Leave empty to include all categories. |
| `maxItems` | Integer | Maximum number of stream records to collect. |
| `requestDelayMs` | Integer | Delay between requests in milliseconds. |
| `userAgent` | String | User-Agent value used for requests. |
| `timeoutSecs` | Integer | Overall run timeout in seconds. |
| `requestTimeoutSecs` | Integer | Individual request timeout in seconds. |

### Example Input

```json
{
  "mode": "topStreams",
  "first": 30,
  "gameName": "",
  "maxItems": 50,
  "requestDelayMs": 1000,
  "userAgent": "ActorResearch/1.0",
  "timeoutSecs": 300,
  "requestTimeoutSecs": 30
}
```

### What Data Does This Actor Extract?

| Field | Description |
|---|---|
| `streamId` | Unique identifier of the live stream. |
| `streamTitle` | Title of the live stream. |
| `viewersCount` | Current number of viewers. |
| `broadcaster` | Broadcaster information, including login and display name. |
| `game` | Game or category associated with the stream. |
| `scrapedAt` | Date and time when the record was collected. |

### Example Output

```json
{
  "streamId": "319543611735",
  "streamTitle": "SPOOKY TIME",
  "viewersCount": 64146,
  "broadcaster": {
    "login": "caseoh_",
    "displayName": "caseoh_"
  },
  "game": {
    "name": "Minecraft"
  },
  "scrapedAt": "2026-10-26T00:00:00+00:00"
}
```

### Use Cases

- **Live Directory Snapshots:** Build spreadsheets of popular live streams ranked by viewer count.
- **Category Monitoring:** Collect streams associated with a particular game or category.
- **Creator Research:** Explore broadcaster login names and display names from public streams.
- **Viewer Analysis:** Compare viewer counts across collected live streams.
- **Scheduled Monitoring:** Run the actor periodically to collect fresh live directory snapshots.

### Working with Your Dataset

After a successful run, access the collected records through the Apify Dataset tab.

You can export the dataset in JSON, CSV, Excel, and other supported formats for analysis, reporting, or further processing.

### FAQ

**Who is this actor for?**

It is designed for analysts, researchers, and developers who want structured information about publicly listed Twitch live streams.

**What data does it collect?**

It collects stream IDs, titles, viewer counts, broadcaster details, game categories, and collection timestamps.

**Can I filter streams by game?**

Yes. Enter a game or category name in `gameName` to filter the collected results.

**Can I collect more than 30 streams?**

You can configure `maxItems` to request more records. However, Twitch may restrict subsequent pages, so the actual number collected can be lower than the requested limit.

**Can I run it on a schedule?**

Yes. You can configure Apify schedules to collect fresh live stream snapshots at your preferred intervals.

**How fresh is the collected data?**

Each run collects information at request time. Viewer counts and stream availability can change after collection.

### Disclaimer

This Actor is an independent tool and is not affiliated with, endorsed by, sponsored by, or officially associated with Twitch or its owners. It collects information from publicly available pages. Users are responsible for ensuring that their use of collected data complies with applicable terms and laws.

### Is Web Scraping Legal?

Collecting information that is already public is generally legal. There is no single law that bans all forms of web scraping. The limits are the usual ones: do not break into accounts, do not take private or confidential data, and be careful with personal data and copyrighted works. A site's terms can also restrict how you access it. Facts such as a public name, price, or rating are not the same thing as republishing someone's article or photo.

This actor collects information from public pages. It does not log in and it does not bypass access controls.

For a longer explanation, see Apify's article [Is web scraping legal?](https://blog.apify.com/is-web-scraping-legal/).

# Actor input Schema

## `mode` (type: `string`):

topStreams = collect 100/500/1000 via multi-strategy. latest = simple first 30 only.

## `first` (type: `integer`):

Streams per GQL request. Twitch caps at 30.

## `gameName` (type: `string`):

Optional: only return streams for this game (case-insensitive). Leave blank for all games.

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

Max streams to collect in topStreams mode. Try 100, 500, or 1000. Ignored in latest mode.

## `concurrency` (type: `integer`):

Parallel requests in topStreams mode. Higher = faster but may hit rate limits.

## `requestDelayMs` (type: `integer`):

Extra delay per request in ms. Usually 0 is fine.

## `userAgent` (type: `string`):

User-Agent header.

## `timeoutSecs` (type: `integer`):

Overall actor run budget in seconds.

## `requestTimeoutSecs` (type: `integer`):

Per-request HTTP timeout in seconds.

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

Optional proxy.

## Actor input object example

```json
{
  "mode": "topStreams",
  "first": 30,
  "gameName": "",
  "maxItems": 100,
  "concurrency": 5,
  "requestDelayMs": 0,
  "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36",
  "timeoutSecs": 300,
  "requestTimeoutSecs": 30,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

## `overview` (type: `string`):

Dataset rows in the overview table.

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

Full dataset for this run.

## `items` (type: `string`):

Dataset items as JSON.

# 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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("real-estate-api/twitch-streams-scraper-gql").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 = {}

# Run the Actor and wait for it to finish
run = client.actor("real-estate-api/twitch-streams-scraper-gql").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 '{}' |
apify call real-estate-api/twitch-streams-scraper-gql --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,real-estate-api/twitch-streams-scraper-gql"
        }
    }
}
```

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/BinLR0YSmay3YzbTi/builds/N0YdKDTvFmPh7FefA/openapi.json
