# Top Twitch User Scrape (`lime_incline/twitch-user-scrape`) Actor

Get top subscribed twitch user list from twitchtracker

- **URL**: https://apify.com/lime_incline/twitch-user-scrape.md
- **Developed by:** [Zee](https://apify.com/lime_incline) (community)
- **Categories:** Social media
- **Security:** Full permissions
- **Stats:** 20 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?

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 User Scraper

This project is an Apify actor that scrapes user data from Twitch Tracker's channel rankings. It uses the Apify SDK and Crawlee to efficiently crawl and extract information from multiple pages of Twitch channel rankings.

### Features

- Scrapes Twitch channel rankings from TwitchTracker.com
- Supports pagination to scrape multiple pages
- Configurable start and end page numbers
- Option to filter by language
- Uses Apify Proxy for IP rotation
- Stores results in Apify Dataset

### How it works

1. The actor reads input parameters (start page, end page, language).
2. It constructs URLs for each page to be scraped.
3. Using CheerioCrawler, it visits each page and extracts channel data.
4. The extracted data is pushed to an Apify Dataset.

### Input

The actor accepts the following input parameters:

- `startPage`: The page number to start scraping from (default: 1)
- `endPage`: The page number to end scraping at (default: 150)
- `language`: The language of channels to scrape (default: "english", leave empty for all languages)
- `proxyConfiguration`: Proxy settings for the scraper

### Output

The actor outputs a dataset with the following structure for each channel:

- `rank`: Channel rank
- `name`: Channel name
- `channellink`: Link to the channel
- `avgViewers`: Average number of viewers
- `hoursStreamed`: Hours streamed
- `peakViewers`: Peak number of viewers
- `hoursWatched`: Total hours watched
- `activeRank`: Active rank
- `followersGained`: Number of followers gained
- `followers`: Total number of followers
- `viewsGained`: Number of views gained

### Usage

1. Clone this repository
2. Install dependencies with `npm install`
3. Run the actor locally with `apify run`

To deploy to the Apify platform:

1. Log in to Apify: `apify login`
2. Deploy the actor: `apify push`

### Customization

You can modify the `src/main.js` file to change the scraping logic or add new features. The input schema can be adjusted in the `.actor/input_schema.json` file.

### Resources

- [Apify SDK Documentation](https://docs.apify.com/sdk/js/)
- [Crawlee Documentation](https://crawlee.dev/)
- [Apify Platform Documentation](https://docs.apify.com/platform)

### License

This project is licensed under the ISC License.

# Actor input Schema

## `startPage` (type: `integer`):

The page number to start scraping from.

## `endPage` (type: `integer`):

The page number to end scraping at.

## `language` (type: `string`):

The language of channels to scrape. Select 'All languages' to scrape all.

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

Select proxies to be used by your actor

## Actor input object example

```json
{
  "startPage": 1,
  "endPage": 150,
  "language": "",
  "proxyConfiguration": {
    "useApifyProxy": 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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("lime_incline/twitch-user-scrape").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("lime_incline/twitch-user-scrape").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 lime_incline/twitch-user-scrape --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,lime_incline/twitch-user-scrape"
        }
    }
}
```

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/Y1ijIv0a7cmD4jCgw/builds/dCvS0QUz8xyW8UPYp/openapi.json
