Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

youtube-video-transcript

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

youtube-video-transcript

Youtube transcript api

  • 1.0.4
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Youtube-Video-Api

MIT license image

A TypeScript Version of Youtube Transcript Api

Description

This repository provides a simple and efficient way to interact with the YouTube Transcript API. It is designed to fetch transcripts from YouTube videos, with support for both single and multiple video transcripts.

Installation

Run this command to install it

npm i youtube-video-transcript 

Example

Quickly import and translate the video of your choice !

import Transcriptor from 'youtube-video-transcript';
await Transcriptor.getTranscript('url or video id', ['en'])

You will receive something like that

    {
        "language" : "en",
        "type" : "auto",
        "data" : [
            {
                "start": 0,
                "duration": 6.339,
                "text": "Hello everyone thanks you so much for the last video"
            }
        ]
    }

It's also possible to fetch transcripts in multiple language

import Transcriptor from 'youtube-video-transcript';
await Transcriptor.getTranscript('url or video id', ['en', 'es'])

You will receive something like that

[
    {
        "language" : "en",
        "type" : "auto",
        "data" : [
            {
                "start": 0,
                "duration": 6.339,
                "text": "Hello everyone thanks you so much for the last video"
            }
        ]
    },
    {
        "language" : "es",
        "type" : "manual",
        "data" : [
            {
                "start": 0,
                "duration": 5.439,
                "text": "¡Hola a todos, muchas gracias por el último video!"
            }
        ]
    }
]

If you want you can download multiple transcripts from different videos

import Transcriptor from 'youtube-video-transcript';
await Transcriptor.getTranscript(['url video 1', 'url video 2'], ['en'])

You will receive something like that

    [
        {
            "language" : "en",
            "type" : "auto",
            "data" : [
                {
                    "start": 0,
                    "duration": 6.339,
                    "text": "Hello everyone thanks you so much for the last video"
                }
            ]
        },
        {
            "language" : "en",
            "type" : "auto",
            "data" : [
                {
                    "start": 0,
                    "duration": 1.219,
                    "text": "Welcome everybody !"
                }
            ]
        }
    ]

If you want you can fetch all the transcripts for a video by doing this

import Transcriptor from 'youtube-video-transcript';
const listTranscripts = await Transcriptor.listTranscripts('video url')

Then use this function to get all the transcripts as an array

listTranscripts.list()

Also you can filter this list to have only the transcripts who are generated

listTranscripts.getAuto()

Or who are created manually

listTranscripts.getManual()

In different languages

listTranscripts.getMultipleLanguages(['en', 'fr', 'es'])

FAQs

Package last updated on 02 May 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc