# Pornhub Video & Analytics Scraper (Fast & Low-Cost) (`haktelaren/pornhub-scraper`) Actor

Ultra-fast Pornhub video scraper with zero browser overhead. Extract video metadata, views, likes, durations, authors, categories, tags, and top comments via high-performance TLS fingerprint emulation.

- **URL**: https://apify.com/haktelaren/pornhub-scraper.md
- **Developed by:** [Celal Tokmak](https://apify.com/haktelaren) (community)
- **Categories:** Videos, Social media, Other
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.10 / 1,000 run initiations

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

## 🚀 Pornhub Video & Analytics Scraper (Fast, Cheap & Zero-Browser)

A state-of-the-art, high-throughput web scraper for Pornhub built for data analysts, market researchers, and AI model creators.

Unlike legacy or abandoned scrapers that rely on heavy, resource-intensive headless browsers (Playwright/Selenium), this Actor uses **asynchronous protocol-level HTTP requests** with **Chrome TLS fingerprint emulation (`curl_cffi`)** to extract rich video intelligence at a fraction of the compute unit (CU) cost.

***

### ⚡ Why This Scraper Beats Other Alternatives

| Feature | Legacy Scrapers (Playwright / Selenium) | This Actor (curl\_cffi + TLS Emulation) |
| :--- | :--- | :--- |
| **Compute Unit Cost** | 🔴 Expensive (0.5 - 2 GB RAM per worker) | 🟢 **Ultra-low (~128 MB RAM, 10x cheaper)** |
| **Speed** | 🔴 5 - 12 seconds per page | 🟢 **0.3 - 0.8 seconds per video** |
| **Anti-Bot Resistance** | 🟡 Easily flagged by Cloudflare canvas checks | 🟢 **Chrome 120 TLS fingerprint spoofing** |
| **Pricing** | 🔴 $10 - $25 per 1,000 results | 🟢 **$1.50 per 1,000 results** |
| **Data Integrity** | 🟡 Often fails on dynamic DOM hydration | 🟢 **Multi-tier parsing (JSON-LD, DOM, embedded variables)** |

***

### 📊 Extracted Data Fields

Each scraped video item produces clean, structured JSON ready for CSV, Excel, or database ingestion:

| Field Name | Type | Description |
| :--- | :--- | :--- |
| `video_id` | String | Unique video key identifier (e.g., `"ph60c7a8b9e1"`) |
| `title` | String | Complete video title |
| `url` | String | Direct canonical video URL |
| `duration` | String | Human-readable duration (e.g., `"14:32"`) |
| `duration_seconds` | Integer | Total duration in seconds (e.g., `872`) |
| `views` | Integer | Normalized numerical view count (e.g., `1245000`) |
| `rating_percent` | Integer | Like / approval rating percentage (e.g., `96`) |
| `upload_date` | String | ISO 8601 upload timestamp (e.g., `"2023-08-14T09:12:00Z"`) |
| `author` | String | Channel, model, or production studio name |
| `pornstars` | Array\[String] | Verified model/performer names |
| `categories` | Array\[String] | Editorial category tags |
| `tags` | Array\[String] | Community & algorithmic search tags |
| `comments_count` | Integer | Total comments count |
| `top_comments` | Array\[Object] | Top user comments with upvotes, author, and timestamp (if enabled) |

#### Sample Output JSON

```json
{
  "video_id": "ph60c7a8b9e1",
  "title": "Lex Fridman Podcast Episode - AI & Consciousness Discussion",
  "url": "https://www.pornhub.com/view_video.php?viewkey=ph60c7a8b9e1",
  "duration": "45:10",
  "duration_seconds": 2710,
  "views": 842100,
  "rating_percent": 95,
  "upload_date": "2023-10-05T14:20:00Z",
  "author": "LexClipsOfficial",
  "pornstars": [],
  "categories": ["Interviews", "Entertainment", "Education"],
  "tags": ["podcast", "discussion", "technology", "ai"],
  "comments_count": 134,
  "top_comments": [
    {
      "author": "TechEnthusiast",
      "comment_text": "Incredible sound engineering on this studio recording.",
      "date": "2 months ago",
      "upvotes": 42
    }
  ]
}
```

***

### 🛠️ Input Parameters

Configure the scraper via the Apify Console or API:

```json
{
  "search_keywords": ["podcast", "interview"],
  "start_urls": [
    "https://www.pornhub.com/view_video.php?viewkey=ph5f89..."
  ],
  "max_items": 100,
  "sort_by": "mostviewed",
  "category": "interviews",
  "include_comments": true,
  "proxy_configuration": {
    "useApifyProxy": true
  }
}
```

#### Parameter Details

- **`search_keywords`** *(Array of Strings)*: Search terms to query across Pornhub's global catalog.
- **`start_urls`** *(Array of URLs)*: Direct video links, channel links, or category URLs.
- **`max_items`** *(Integer, default: 50)*: Maximum number of video records to scrape.
- **`sort_by`** *(String, default: "mostviewed")*: Choose between `"mostviewed"`, `"toprated"`, or `"newest"`.
- **`category`** *(String, optional)*: Filter search queries by category slug.
- **`include_comments`** *(Boolean, default: false)*: Extracts top user comments with author, date, and upvote counts.
- **`proxy_configuration`** *(Object)*: Apify Proxy configuration for maximum uptime across geo-restricted regions.

***

### 🎯 High-Value Business Use Cases

1. **Market Research & Creator Intelligence**: Track audience engagement, view distributions, and trending themes across digital video entertainment.
2. **Content Moderation & Brand Safety**: Audit digital platforms for unauthorized content, trademark mentions, or DMCA infringements.
3. **AI & Machine Learning Datasets**: Collect structured metadata for natural language processing (NLP), video recommendation algorithms, and classification pipelines.
4. **Competitor & Channel Benchmarking**: Analyze top-performing formats, release schedules, and user rating trends.

***

### 🔒 Privacy & Compliance

This tool extracts public metadata solely for legitimate analytics and research purposes. It adheres to Apify's ethical scraping guidelines and does not download or host copyrighted audiovisual streams.

# Actor input Schema

## `search_keywords` (type: `array`):

Keywords to discover and scrape videos on Pornhub (e.g., \['podcast', 'interview', 'gaming']).

## `start_urls` (type: `array`):

Direct Pornhub video links (e.g. 'https://www.pornhub.com/view\_video.php?viewkey=ph...'), category pages, or model/channel URLs.

## `max_items` (type: `integer`):

Total maximum number of video items to collect and save to the dataset.

## `sort_by` (type: `string`):

Sorting criteria for search results and category discovery.

## `category` (type: `string`):

Optional category tag or slug to filter search results (e.g. 'amateur', 'interviews').

## `include_comments` (type: `boolean`):

Whether to extract top user comments, upvotes, and author usernames for each video.

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

Apify Proxy or custom residential proxy settings. Required for consistent access across international regions.

## Actor input object example

```json
{
  "search_keywords": [
    "interview"
  ],
  "start_urls": [],
  "max_items": 50,
  "sort_by": "mostviewed",
  "category": "",
  "include_comments": false,
  "proxy_configuration": {
    "useApifyProxy": true
  }
}
```

# Actor output Schema

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

Dataset containing all scraped Pornhub video records (JSON, CSV, Excel).

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

Interactive table view of scraped video records in Apify Console.

# 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("haktelaren/pornhub-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 = {}

# Run the Actor and wait for it to finish
run = client.actor("haktelaren/pornhub-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 '{}' |
apify call haktelaren/pornhub-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,haktelaren/pornhub-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/Vf4ccFoygURfi1f17/builds/1sTfCis07ay7a26MV/openapi.json
