# YTDS (`accomplished_yapok/ytds`) Actor

Yt data scraper

- **URL**: https://apify.com/accomplished_yapok/ytds.md
- **Developed by:** [Kween Ash](https://apify.com/accomplished_yapok) (community)
- **Categories:** AI
- **Stats:** 7 total users, 0 monthly users, 100.0% runs succeeded, 0 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

## YouTube Scraper Actor (no external APIs)

Scrape YouTube channels, playlists, videos, and search results using Playwright and YouTube’s own page data (DOM + `window.ytInitial*`). No YouTube Data API and no `youtube-transcript-api`.

### What’s new

- Channel info only mode: set `channelInfoOnly = true` to scrape only the channel’s “About” data for the URLs you provide (channel or video). The actor will not scrape any videos or run searches in this mode.
- Accepts:
  - Channel URLs (e.g., `https://www.youtube.com/@theleaderstalk`, `https://www.youtube.com/channel/UCC...`)
  - Video URLs (the actor resolves the channel from the video)
  - A single `@handle` in `searchTerms` (e.g., `["@theleaderstalk"]`)

Output in this mode (`type: "channel_info"`):

- channelName
- channelUrl (prefers handle URL when available)
- channelUsername (handle without the `@`)
- channelId
- description
- channelLocation
- joinedDate
- channelTotalVideos
- channelTotalViews (numeric) and channelTotalViewsFormatted (with commas)
- numberOfSubscribers (numeric) and subscriberCountText
- socialLinks (array of `{ title, url }`)
- avatarUrl
- isMonetized (best-effort)
- sourceUrl (the input you provided)

### Other capabilities

- Channel enrichment (when not in channel-only mode):
  - name, URL, ID, @handle, subscriber counts, total views, total videos, location, social links, avatar, description, joined date
- Video details:
  - title, URL, thumbnail, view count, likes (best-effort), comments count (best-effort)
  - release date (ISO), duration (seconds + HH:MM:SS), hashtags
  - optional subtitles scraped via the UI, optional comments
- Search with rich UI filters (applied via YouTube “Filters” menu):
  - sorting, date filter, type, duration
  - feature toggles: HD, Subtitles/CC, Creative Commons, 3D, Purchased, 4K, 360°, Location
- Per-term limits for search (videos/shorts/streams)

### Input

Key fields:

- `channelInfoOnly` (boolean): Only scrape channel About info for provided URLs. If true:
  - Provide one or more channel or video URLs in `startUrls`, or
  - Provide a single `@handle` in `searchTerms`; the actor will treat it as a channel.
- `startUrls`: URLs to process (channel, video, playlist, search results)
- `directUrls`: extra URLs to merge into `startUrls`
- `searchTerms`: terms to search (ignored when `channelInfoOnly` is true unless a single `@handle` is provided)
- Subtitles options: `downloadSubtitles`, `saveSubsToKVS`, `subtitlesLanguage`, `preferAutoGeneratedSubtitles`, `subtitlesFormat`
- Search filters (non-channelOnly): `searchSortOrder`, `searchDateFilter`, `searchVideoType`, `searchDuration`
- Features (non-channelOnly): `hd`, `subtitles_cc`, `creative_commons`, `three_d`, `purchased`, `four_k`, `three_sixty`, `location`
- Limits: `maxVideosPerTerm`, `maxShortsPerTerm`, `maxStreamsPerTerm`, `maxResults`, `maxComments`
- Filters for post-processing: `dateFilter`, `videoRegex`
- `proxyConfiguration`, `verboseLog`

#### Examples

Channel info only

```json
{
  "channelInfoOnly": true,
  "startUrls": [
    { "url": "https://www.youtube.com/@theleaderstalk" },
    { "url": "https://www.youtube.com/watch?v=zslTD2Mq00E" }
  ],
  "proxyConfiguration": { "useApifyProxy": true }
}
```

Channel + videos (not channel-only)

```json
{
  "startUrls": [{ "url": "https://www.youtube.com/@LofiGirl" }],
  "maxResults": 50,
  "proxyConfiguration": { "useApifyProxy": true }
}
```

Search with filters

```json
{
  "searchTerms": ["traveler", "ai trends 2025"],
  "maxVideosPerTerm": 15,
  "maxShortsPerTerm": 8,
  "maxStreamsPerTerm": 2,
  "searchSortOrder": "relevance",
  "searchDateFilter": "this_year",
  "searchVideoType": "video",
  "searchDuration": "any",
  "hd": true,
  "subtitles_cc": true,
  "downloadSubtitles": true,
  "fetchFullVideoDetails": true,
  "maxResults": 30,
  "proxyConfiguration": { "useApifyProxy": true }
}
```

To search for the keyword

```json
{
  "startUrls": [],
  "searchTerms": ["marketing"],
  "maxResults": 10,
  "maxVideosPerTerm": 10,
  "proxyConfiguration": { "useApifyProxy": false },
  "verboseLog": false
}
```

### Notes and limitations

- YouTube does not expose subscriber usernames publicly; this actor cannot collect them.
- Likes and comments counts can be hidden; values are best‑effort.
- Layouts vary by region; enable Apify Proxy for more consistent results.

### Local development

```bash
pip install -r requirements.txt
python -m playwright install --with-deps chromium
python main.py
```

# Actor input Schema

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

List of YouTube Channel URLs or Video URLs.

## `searchTerms` (type: `array`):

Keywords to search for.

## `maxVideosPerTerm` (type: `integer`):

How many regular videos to scrape per channel or search term.

## `maxShortsPerTerm` (type: `integer`):

How many Shorts to scrape per channel.

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

Select proxies to be used by your crawler.

## Actor input object example

```json
{
  "startUrls": [
    "https://www.youtube.com/@mychemicalromance"
  ],
  "searchTerms": [],
  "maxVideosPerTerm": 10,
  "maxShortsPerTerm": 10,
  "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 = {
    "startUrls": [
        "https://www.youtube.com/@mychemicalromance"
    ],
    "proxyConfiguration": {
        "useApifyProxy": true
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("accomplished_yapok/ytds").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": ["https://www.youtube.com/@mychemicalromance"],
    "proxyConfiguration": { "useApifyProxy": True },
}

# Run the Actor and wait for it to finish
run = client.actor("accomplished_yapok/ytds").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 '{
  "startUrls": [
    "https://www.youtube.com/@mychemicalromance"
  ],
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}' |
apify call accomplished_yapok/ytds --silent --output-dataset

```

## MCP server setup

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

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/RDZW45ag6TIgxtlhz/builds/CAaTyeTkiSOpzCXGm/openapi.json
