# Twitter/x video transcript (`linen_snack/twitter-subtitles-transcript`) Actor

Effortlessly convert any public Twitter/X video into accurate text, subtitles, or translations with this powerful OpenAI Whisper API actor.

- **URL**: https://apify.com/linen\_snack/twitter-subtitles-transcript.md
- **Developed by:** [ius iyb](https://apify.com/linen_snack) (community)
- **Categories:** AI, Social media, Videos
- **Stats:** 8 total users, 0 monthly users, 0.0% runs succeeded, 1 bookmarks
- **User rating**: No ratings yet

## Pricing

$3.00/month + usage

To use this Actor, you pay a monthly rental fee to the developer. The rent is subtracted from your prepaid usage every month after the free trial period.You also pay for the Apify platform usage, which gets cheaper the higher Apify subscription plan you have.

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

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — 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

## Twitter/X Video Transcriber & Translator

This Apify actor downloads a public Twitter/X video, extracts its audio, and uses the OpenAI Whisper API to either transcribe it into its original language or translate it into English. It's built to be robust, automatically handling video-to-audio conversion and compression to stay within API limits.

It supports all the latest features from the OpenAI Audio API, including multiple models (`whisper-1`, `gpt-4o-transcribe`), various output formats (JSON, SRT, VTT), and word-level timestamp generation.

### Key Features

- **Direct Transcription from URL**: Simply provide a public Twitter/X video URL.
- **Transcription & Translation**: Choose to transcribe in the original language or translate directly to English.
- **Multiple OpenAI Models**: Supports `whisper-1`, `gpt-4o-transcribe`, and `gpt-4o-mini-transcribe`.
- **Automatic Audio Handling**: The actor automatically extracts the audio from the `.mp4` video and compresses it to an `.mp3` to avoid OpenAI's 25 MB file size limit.
- **Word-Level Timestamps**: Get precise start and end times for each word in the transcript (requires `whisper-1`).
- **Rich Output Formats**: Get your transcript back as plain text, structured JSON, or subtitle formats like SRT and VTT.
- **Advanced Control**: Customize the output with optional parameters like language hints and temperature settings.

### Cost of Usage

This actor uses two services that may have associated costs:

1. **Apify Platform**: You will be charged for Apify [Compute Units (CUs)](https://docs.apify.com/platform/actors/running/usage-and-resources#compute-units) while the actor runs. The consumption is generally low for this task, as it primarily waits for API responses.
2. **OpenAI API**: The primary cost will come from the OpenAI API. You must provide your own OpenAI API key, and you will be billed by OpenAI for the audio processing. For the most current pricing, please refer to the [OpenAI Pricing Page](https://openai.com/pricing#audio-models).

### Input Configuration

The actor requires the following input configuration.

| Field | Type | Description |
| :--- | :--- | :--- |
| **`Twitter/XUrl`** | `String` | **(Required)** The full URL of the public Twitter/X video you want to process. |
| **`openaiApiKey`** | `String` | **(Required)** Your secret API key from OpenAI. It's highly recommended to set this as a [secret environment variable](https://docs.apify.com/platform/actors/development/environment-variables#secrets) for security. |
| **`task`** | `String` | The task to perform. Can be `transcription` (default) or `translation`. Translation will always output in English. |
| **`model`** | `String` | The OpenAI model to use. `whisper-1` (default) supports all features. `gpt-4o-transcribe` and `gpt-4o-mini-transcribe` are newer but have some limitations. **Note:** Translation and Timestamps require `whisper-1`. |
| **`language`** | `String` | (Optional) The language of the audio in [ISO-639-1 format](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) (e.g., `en`, `es`, `zh`). Supplying this can improve accuracy. |
| **`prompt`** | `String` | (Optional) A text prompt to guide the model's style or to correct specific words and acronyms that are often misrecognized. |
| **`response_format`** | `String` | The output format of the transcript. Default is `json`. **Note:** `gpt-4o` models only support `json` or `text`. Timestamps require `verbose_json`. |
| **`temperature`** | `String` | (Optional) A value between 0 and 1. Higher values (e.g., 0.8) make the output more random; lower values (e.g., 0.2) make it more focused. |
| **`timestamp_granularities`** | `Array` | (Optional) Request word or segment-level timestamps. **Requires `whisper-1` model and `verbose_json` response format.** |

### Output

The actor will save its results to the default Apify dataset. The output is a JSON object that contains the task and model used, along with the full result from the OpenAI API.

#### Example Output (`verbose_json` with word timestamps)

```json
[{
  "task": "transcription",
  "model": "whisper-1",
  "result": {
    "text": "This is a test of the Twitter/X transcriber.",
    "segments": [
      {
        "id": 0,
        "seek": 0,
        "start": 0,
        "end": 3.5,
        "text": " This is a test of the Twitter/X transcriber.",
        "tokens": [ ... ],
        "temperature": 0,
        "avg_logprob": -0.25,
        "compression_ratio": 1.2,
        "no_speech_prob": 0.1
      }
    ],
    "words": [
      {
        "word": "This",
        "start": 0.5,
        "end": 0.7
      },
      {
        "word": "is",
        "start": 0.7,
        "end": 0.8
      },
      {
        "word": "a",
        "start": 0.8,
        "end": 0.9
      },
      {
        "word": "test",
        "start": 0.9,
        "end": 1.2
      },
      ...
    ],
    "language": "english"
  }
}]
```

### How to Use

1. Navigate to the actor on the Apify platform.
2. Click the "Try actor" button.
3. Enter the **Twitter/X Video URL** and your **OpenAI API Key**.
4. (Optional) Adjust the other configuration options as needed.
5. Click the **Start** button and wait for the run to finish.
6. Once finished, check the **Output** tab in the run console to view and download your results.

### Limitations

- The input Twitter/X video must be **publicly accessible**. Private or deleted videos will cause an error.

***

# Actor input Schema

## `twitterUrl` (type: `string`):

The URL of the Twitter/x video you want to process.

## `openaiApiKey` (type: `string`):

Your OpenAI API key. Best practice is to set this as a secret environment variable.

## `task` (type: `string`):

Choose whether to transcribe the audio into its original language or translate it into English.

## `model` (type: `string`):

Select the model. Note: 'translation' and 'timestamp\_granularities' tasks require 'whisper-1'.

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

The language of the audio in ISO-639-1 format (e.g., 'en', 'es'). Improves accuracy. Required by some models.

## `prompt` (type: `string`):

A prompt to guide the model's style or to correct specific words and acronyms.

## `response_format` (type: `string`):

The output format. Note: 'gpt-4o-\*' models only support 'json' or 'text'. Timestamps require 'verbose\_json'.

## `temperature` (type: `string`):

A value between 0 and 1. Higher values (e.g., 0.8) are more random; lower values (e.g., 0.2) are more focused.

## `timestamp_granularities` (type: `array`):

Request word or segment-level timestamps. Requires 'whisper-1' model and 'verbose\_json' response format.

## Actor input object example

```json
{
  "task": "transcription",
  "model": "whisper-1",
  "response_format": "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 = {
    "task": "transcription",
    "model": "whisper-1",
    "response_format": "json"
};

// Run the Actor and wait for it to finish
const run = await client.actor("linen_snack/twitter-subtitles-transcript").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 = {
    "task": "transcription",
    "model": "whisper-1",
    "response_format": "json",
}

# Run the Actor and wait for it to finish
run = client.actor("linen_snack/twitter-subtitles-transcript").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 '{
  "task": "transcription",
  "model": "whisper-1",
  "response_format": "json"
}' |
apify call linen_snack/twitter-subtitles-transcript --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=linen_snack/twitter-subtitles-transcript",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/3uxDeeP5V7IrhOKab/builds/j35InzJMAf8p1kS01/openapi.json
