Back to all posts

How to Scrape TikTok Transcripts - The Easy Way

Jonathan Geiger
tiktokapiweb-scrapingtutorialtranscript

Extracting transcripts from TikTok videos manually is time-consuming and doesn't scale well. Whether you're analyzing trending content, building social media tools, or conducting research, you need a reliable way to get TikTok transcripts programmatically.

In this guide, I'll show you how to scrape TikTok transcripts using SocialKit's TikTok Transcript API - a simple solution that handles all the complexity of TikTok's anti-bot protections, CAPTCHAs, and dynamic content loading.

Getting Started

1. Get Your API Access Key

First, you'll need an API access key. Head to your SocialKit Dashboard to grab your free access key. The free tier includes 20 requests - perfect for testing and small projects.

2. The API Endpoint

Here's the endpoint you'll be working with:

GET https://api.socialkit.dev/tiktok/transcript

Required Parameters:

  • access_key: Your API access key
  • url: The TikTok video URL you want to extract transcripts from

Example Request & Response

Let's look at a real example using this TikTok video:

GET https://api.socialkit.dev/tiktok/transcript?access_key=<your-access-key>&url=https://www.tiktok.com/@thepeteffect/video/7522711492140059912

Response:

{
	"success": true,
	"data": {
		"url": "https://www.tiktok.com/@thepeteffect/video/7522711492140059912",
		"transcript": "Ever been randomly attacked by your cat and thought, what did I do? Don't worry. There's usually a reason behind the chaos. 1, play aggression. Cats are born hunters and sometimes your hand, foot or even your face becomes the prey...",
		"transcriptSegments": [
			{
				"text": "Ever been randomly attacked by your cat and thought,",
				"start": 0.04,
				"duration": 2.4,
				"timestamp": "00:00"
			},
			{
				"text": "what did I do? Don't worry.",
				"start": 2.441,
				"duration": 1.64,
				"timestamp": "00:02"
			},
			{
				"text": "There's usually a reason behind the chaos.",
				"start": 4.082,
				"duration": 1.899,
				"timestamp": "00:04"
			}
		],
		"wordCount": 157,
		"segments": 23
	}
}

You get:

  • Full transcript as plain text
  • Timestamped segments with precise start times and durations
  • Word count for quick content analysis
  • Segment count to understand video structure

Code Examples

Choose your preferred language and start extracting TikTok transcripts:

JavaScript/Node.js Example

const axios = require('axios');

/**
 * Extract transcript from a TikTok video
 * @param {string} videoUrl - The TikTok video URL
 * @param {string} accessKey - Your SocialKit API access key
 * @returns {Promise<Object>} Transcript data
 */
async function getTikTokTranscript(videoUrl, accessKey) {
	const endpoint = 'https://api.socialkit.dev/tiktok/transcript';

	try {
		const response = await axios.get(endpoint, {
			params: {
				access_key: accessKey,
				url: videoUrl,
			},
		});

		const data = response.data;

		if (data.success) {
			return data.data;
		} else {
			throw new Error(`API Error: ${data.message || 'Unknown error'}`);
		}
	} catch (error) {
		if (error.response) {
			throw new Error(
				`API Error: ${error.response.data.message || error.response.statusText}`
			);
		}
		throw new Error(`Request failed: ${error.message}`);
	}
}

// Usage
(async () => {
	const ACCESS_KEY = 'your-access-key-here';
	const VIDEO_URL =
		'https://www.tiktok.com/@thepeteffect/video/7522711492140059912';

	try {
		const result = await getTikTokTranscript(VIDEO_URL, ACCESS_KEY);

		console.log(`Video URL: ${result.url}`);
		console.log(`Word Count: ${result.wordCount}`);
		console.log(`Segments: ${result.segments}`);
		console.log(`\nFull Transcript:\n${result.transcript}`);

		console.log('\n--- First 3 Segments ---');
		result.transcriptSegments.slice(0, 3).forEach((segment) => {
			console.log(`[${segment.timestamp}] ${segment.text}`);
		});
	} catch (error) {
		console.error(`Error: ${error.message}`);
	}
})();

Python Example

import requests

def get_tiktok_transcript(video_url, access_key):
    """
    Extract transcript from a TikTok video

    Args:
        video_url: The TikTok video URL
        access_key: Your SocialKit API access key

    Returns:
        dict: Transcript data including full text and timestamped segments
    """
    endpoint = "https://api.socialkit.dev/tiktok/transcript"

    params = {
        "access_key": access_key,
        "url": video_url
    }

    try:
        response = requests.get(endpoint, params=params)
        response.raise_for_status()

        data = response.json()

        if data["success"]:
            return data["data"]
        else:
            raise Exception(f"API Error: {data.get('message', 'Unknown error')}")

    except requests.exceptions.RequestException as e:
        raise Exception(f"Request failed: {str(e)}")

# Usage
if __name__ == "__main__":
    ACCESS_KEY = "your-access-key-here"
    VIDEO_URL = "https://www.tiktok.com/@thepeteffect/video/7522711492140059912"

    try:
        result = get_tiktok_transcript(VIDEO_URL, ACCESS_KEY)

        print(f"Video URL: {result['url']}")
        print(f"Word Count: {result['wordCount']}")
        print(f"Segments: {result['segments']}")
        print(f"\nFull Transcript:\n{result['transcript']}")

        print("\n--- First 3 Segments ---")
        for segment in result['transcriptSegments'][:3]:
            print(f"[{segment['timestamp']}] {segment['text']}")

    except Exception as e:
        print(f"Error: {str(e)}")

Use Cases

Here are some practical ways to use TikTok transcript extraction:

  1. Content Analysis: Analyze trending topics and keywords in viral TikTok videos
  2. Accessibility: Create subtitles and captions for hearing-impaired audiences
  3. Research: Study social media language patterns and communication trends
  4. SEO: Extract content for blog posts or video descriptions
  5. Sentiment Analysis: Combine with AI to analyze tone and emotion in TikTok content
  6. Content Curation: Search and filter videos based on spoken content

Try It Free First

Want to test the transcript quality before integrating the API? Use our free TikTok Transcript Extractor tool to extract transcripts from any TikTok video directly in your browser. No coding required!

Expand your TikTok and YouTube data extraction capabilities:

Conclusion

Extracting TikTok transcripts doesn't have to be complicated. With SocialKit's TikTok Transcript API, you can skip the headaches of web scraping, CAPTCHA solving, and browser automation.

Get your free API access key and start extracting TikTok transcripts in minutes. Whether you're building analytics tools, conducting research, or creating accessible content, you'll have reliable transcript data at your fingertips.

Happy coding! 🚀