Skip to main content

Using Gladia's Whisper API for transcribing YouTube videos

Project description


WhisperYT is a Python client for interacting with Gladia's API designed specifically for transcribing YouTube videos. Powered by an optimized variant of OpenAI's Whisper model, Gladia's backend performs Automatic Speech Recognition (ASR), converting spoken words into written text with remarkable precision. Best of all, you can enjoy up to 10 hours of free API usage each month.

In addition to providing access to Gladia's API, this versatile library equips you with postprocessing features to effortlessly manipulate and refine your transcribed data, making it a valuable tool for post-transcription tasks.

Install


pip install whisperyt

Quick Start


The initial step involves initializing the YouTubeTranscriber class before proceeding with your API request. To get started, simply create a free account on Gladia's site and provide your API token. Afterwards, pass the YouTube video URL of your choice:

from whisperyt import YouTubeTranscriber, DataProcessor

gladia = YouTubeTranscriber("YOUR-API-KEY")

response = gladia.transcribe("https://www.youtube.com/watch?v=BrcKRhQ7K00")
print(DataProcessor.pretty_json(response))

Chunk of output:


Save Transcription to JSON File

from whisperyt import YouTubeTranscriber, DataProcessor

gladia = YouTubeTranscriber("YOUR-API-KEY")

response = gladia.transcribe("https://www.youtube.com/watch?v=BrcKRhQ7K00")
DataProcessor.save_json_file(response.json(), "output.json")

View Transcription in Pandas Dataframe

After your transcription has been saved in a JSON file, you can load it in a Pandas Dataframe:

df = DataProcessor.get_table("output.json")
print(df)

Output:


View Transcription by Speaker Turn:

From Dataframe, display transcription by speaker turn:

df = DataProcessor.get_table("output.json")
DataProcessor.print_transcription_by_turn(df)

Output:


Best Practices with Gladia's API

Audio Length: The maximum length of audio that can be transcribed in a single request is currently 135 minutes. Attempts to transcribe longer audio files may result in errors.

File Size: Audio files must not exceed 500 MB in size. Larger files will not be accepted by the API.

API Call Limits: To ensure the quality of service and fairness to all users, API call limits have been implemented. For the free tier, users can make a maximum of 20 calls per hour, with up to 3 concurrent requests. Users subscribed to the Pro tier can make up to 200 calls per minute and up to 15 concurrent requests.

For further details, refer to the documentation.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

whisperyt-0.1.2.tar.gz (6.3 kB view hashes)

Uploaded Source

Built Distribution

whisperyt-0.1.2-py3-none-any.whl (9.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page