Skip to main content

A CLI tool to download audio from a YouTube video, transcribe it, and refine the transcription using AI.

Project description

ytdebunk

Overview

ytdebunk is a command-line tool designed to:

  • Download audio from YouTube videos.
  • Transcribe the audio content.
  • Optionally enhance the transcription using the Gemini API.

This tool is particularly useful for analyzing transcriptions to identify logical fallacies and incorrect claims made by YouTubers.

Installation

For avoiding conflicts better create a virtual environment and start working on it:

python3.11 -m venv .venv
source .venv/bin/activate

Now, you can install from PyPI using,

pip install ytdebunk

Alternatively, for latest updated please try installing directly from Github using:

pip install git+https://github.com/hissain/youtuber-debunked.git

Usage

The ytdebunk.py script provides a command-line interface (CLI) with several options.

Arguments

  • video_url (str) – URL of the YouTube video to download audio from.

Options

Option Description
-e, --enhance (bool) Enhance the transcription using the Gemini API. (Default: False)
-d, --detect (bool) Detect logical fallacies, bias, irony, faults in the transcription using Gemini API. (Default: False)
-o, --output_file (str) Path to save the final transcription. (Default: downloads/transcription.txt)
-v, --verbose (bool) Increase output verbosity.
-t, --token (str) API token for the Gemini API (Required if --enhance is enabled).

Example Usage

ytdebunk "https://www.youtube.com/watch?v=example" -e -o output.txt -v -t YOUR_GEMINI_API_TOKEN
export GEMINI_API_TOKEN="your_api_key"
ytdebunk "https://www.youtube.com/watch?v=example" #when Gemini API key is in environment

Environment Variables

If preferred, you can set the Gemini API token as an environment variable instead of passing it as a CLI argument:

export GEMINI_API_TOKEN="your_api_key"

Detailed Process

  1. Download Audio

    • Uses the download_audio function from ytdebunk.downloader to download audio from the given YouTube URL.
  2. Transcribe Audio

    • Uses the transcribe_audio function from ytdebunk.transcriber to generate a text transcription.
  3. Enhance Transcription (Optional)

    • If --enhance is enabled, the script uses enhance_transcription from ytdebunk.refiner to refine the transcription using the Gemini API.
    • The API token must be provided via --token or as an environment variable.
  4. Save Transcription

    • The final transcription (raw or enhanced) is saved to the specified output file.

Error Handling

  • If --enhance is enabled but no Gemini API token is provided, the script prints an error message and exits.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Contribution and Contact

You can Contact to the author hissain.khan@gmail.com

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

ytdebunk-1.0.2.tar.gz (8.9 kB view details)

Uploaded Source

Built Distribution

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

ytdebunk-1.0.2-py3-none-any.whl (9.3 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for ytdebunk-1.0.2.tar.gz
Algorithm Hash digest
SHA256 5d0280b3797691bf707d9d4d9c39f1e5347014bf995710c9775efc17a1975a7e
MD5 955e606bc017113a186c8b1a5532ca59
BLAKE2b-256 9d1a3eb6ea3a3e540a910e1a42cc54f4707d6abefc8259719e8cf37ae52eb5af

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for ytdebunk-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 917d68cccdcd84b11da1201267e31fa45c4ee6196c927322cbe2658e31fb4709
MD5 efb70dd2c50177784abd046f2856de25
BLAKE2b-256 6279dbfe40bb926178d194141e312c764198d42db7707f5caf4de9b83ad58e66

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