Skip to main content

Extract text from a YouTube video in a single command, using OpenAi's Whisper speech recognition model

Project description

YT2TEXT

Extract text from a YouTube video in a single command, using OpenAi's Whisper speech recognition model. It doesn't use disk, performs everything in memory.

INSTALL:

pip install yt2text

Whisper requires ffmpeg to be installed in your computer. Check Whisper's requirements https://github.com/openai/whisper#setup

USAGE:

You'll only interact with the get_text function. It takes a YouTube URL as an argument and returns the text as a string.

import yt2text

text = yt2text.get_text("https://www.youtube.com/watch?v=fLeJJPxua3E")
print(text)

OPTIONAL ARGUMENTS:

model: Set Whisper model (tiny,base,small,medium or large). Check here for details: https://github.com/openai/whisper#available-models-and-languages

Defaults to "base" which should be good enough for most cases. The first time you use a model, it will be downloaded first.

verbose Set True to print each step of the process. Defaults to False, it only prints if there is an error.

Usage with optional arguments

import yt2text

text = yt2text.get_text("https://www.youtube.com/watch?v=fLeJJPxua3E", model="medium", verbose=True)
print(text)

Contact

Raise an Issue in yt2text's GitHub repo https://github.com/atahanuz/yt2text

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

yt2text-1.0.2.tar.gz (2.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

yt2text-1.0.2-py3-none-any.whl (3.2 kB view details)

Uploaded Python 3

File details

Details for the file yt2text-1.0.2.tar.gz.

File metadata

  • Download URL: yt2text-1.0.2.tar.gz
  • Upload date:
  • Size: 2.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.0

File hashes

Hashes for yt2text-1.0.2.tar.gz
Algorithm Hash digest
SHA256 b31f4920f7a69d0bb75acea9fab928b11f93277f370b2664936d2300c72ff766
MD5 32f8d207f7f7f481bff907bf8ddde0cd
BLAKE2b-256 d7cc0c3667cb2acb961e9bcc67fa7c011947de7634a6c60d82eae3d948e5a21e

See more details on using hashes here.

File details

Details for the file yt2text-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: yt2text-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 3.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.0

File hashes

Hashes for yt2text-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 24b8846f860c411cd71a5aee3d6771927a687810a7e0b06f0961604785981af6
MD5 8a6a3d1d43ef4cab18308852a2f6c69d
BLAKE2b-256 a23606200f01b86132424dbbd7668701cc7e92906c7e5ece9a305fa0eb741cbb

See more details on using hashes here.

Supported by

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