---
title: "Discussion on \"Extracting YouTube Transcripts with JavaScript\" | Hashnode"
description: "Discussion on \"Extracting YouTube Transcripts with JavaScript\". YouTube videos often contain valuable information, and extracting transcripts can be useful for various purposes, from accessibility to content analysis. In"
url: "https://hashnode.com/posts/extracting-youtube-transcripts-with-javascript/65ad38d9d89b4deae7c332c0"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Extracting YouTube Transcripts with JavaScript](https://blog.nidhin.dev/extracting-youtube-transcripts-with-javascript?utm_source=hashnode&utm_medium=feed)

YouTube videos often contain valuable information, and extracting transcripts can be useful for various purposes, from accessibility to content analysis. In

Jan 21, 2024 · 4 min read · blog.nidhin.dev  
Read the article

-   [#youtube](https://hashnode.com/tag/youtube)
-   [#javascript](https://hashnode.com/tag/javascript)
-   [#transcript](https://hashnode.com/tag/transcript)

## Written by

[nidhinkumar](https://hashnode.com/@nidhinkumar)

@nidhinkumar · Coimbatore, Tamilnadu, India

  
[View profile](https://hashnode.com/@nidhinkumar)

Software Engineer

## Responses 4

Markdown supported · ⌘↵ to post

[Shriyash Parandkar](https://hashnode.com/@Shriyash-dev)

[Apr 18, 2025](https://hashnode.com/posts/extracting-youtube-transcripts-with-javascript/65ad38d9d89b4deae7c332c0/comment/6802c2d1c6166f5d22c68ffa)

❌ This failed for me: const transcriptRes = await page.goto(tracks\[0\].baseUrl + '&fmt=json3'); const transcriptJson = await transcriptRes.json(); // YouTube blocks this

✅ This worked like magic: const result = await page.evaluate(async () => { const response = await fetch(baseUrl); // Works inside browser context const transcript = await response.json(); });

If you're stuck, this change makes all the difference! Thanks for sharing 🙌 Finally got it working — what a relief! 😂

[Shanise Smith](https://hashnode.com/@Pixie3)

[Oct 28, 2024](https://hashnode.com/posts/extracting-youtube-transcripts-with-javascript/65ad38d9d89b4deae7c332c0/comment/672020a99f774f42d3464b94)

This works on localhost, but my application is now in production and it's not working at all. Can you please help me with this?

[Harminder Singh Nijjar](https://hashnode.com/@harmindersinghnijjar)

[Oct 17, 2024](https://hashnode.com/posts/extracting-youtube-transcripts-with-javascript/65ad38d9d89b4deae7c332c0/comment/6710576cf13c3ebb8f85a83c)

Doing God's work 🙏🏽

[Jim Bowen](https://hashnode.com/@jbowen28)

[Sep 12, 2024](https://hashnode.com/posts/extracting-youtube-transcripts-with-javascript/65ad38d9d89b4deae7c332c0/comment/66e378a138aa6c861fc0b709)

Just what I was looking for! But I am getting a CORS error because I am running the code from localhost. Apparently, you embedded your code in the youtube video page from which you are getting the transcript, somehow. Do you have some code to get around the CORS error to make your code more generally applicable?

[Jim Bowen](https://hashnode.com/@jbowen28)

[Sep 12, 2024](https://hashnode.com/posts/extracting-youtube-transcripts-with-javascript/65ad38d9d89b4deae7c332c0/comment/66e378a138aa6c861fc0b709#reply-66e3796d23599d2d9a7b6e1f)

To get around the CORS error, I executed your code in my web server via an API call and returned the transcript in the API.
