Skip to main content

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

Project description

ytdebunk

Overview

Current Features:

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.
  • Optionally detect logical faults in the transctiption using the Gemini API.

Features in queue:

  • Classifying assertive claims from the transcription.
  • Fact-checking and validation of the claims from reliable source using online search and agentic AI.
  • Re-organizing the factual faults and logical faults.
  • Preparing a script for a hypothetical debunker charecter using generative AI (or AI Agents).
  • Synthesizing the script to create an audio and a video using generative AI (or AI Agents).

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

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 CLI Tool)

The ytdebunk is a command-line interface (CLI) with several options.

Arguments

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

Options

Option Description
-l, --language (str) Language (code) of the transcription. Valid: [bn, en], default: en
-e, --enhance (bool) Enhance the transcription using the Gemini API. (Default: False)
-d, --detect (bool) Detect logical faults in the transcription using Gemini API. (Default: False)
-v, --verbose (bool) Increase verbosity in logging.
-t, --token (str) API token for the Gemini API (Required if --enhance or --detectis enabled).
-st, --start_time (float) Start time of the audio clip in seconds
-et, --end_time (float) End time of the audio clip in seconds
-m, --model (str) A transcription model name from Huggingface (WhisperFeatureExtractor)

Example Usage

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

See an example notebook Example Notebook file for details usage.

Usage (The Streamlit App)

You can simply run the streamlit app to see the demo.

Install the streamlit using pip

pip install streamlit

Run the app.py using streamlit

streamlit run app.py

Screenshots of the Streamlit App

Query Fields English Transcription Result English

Query Fields Bangla Transcription Result Bangla Logical Fults Detected Bangla

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. Detect Logical Faults (Optional)

    • If --detect is enabled, the script uses detect_logical_faults from ytdebunk.philosopher to detect logical fults, fallacies, bias, irony and so on in the transcription using the Gemini API.
    • The API token must be provided via --token or as an environment variable.
  5. Save Transcription

    • The final transcription and logical faults (raw or enhanced) are saved to the ./download folder.

Error Handling

  • If --enhance or --detect are 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 fork this project and submit pull request in the project. Please contact to the author at 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.1.0.tar.gz (9.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.1.0-py3-none-any.whl (10.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ytdebunk-1.1.0.tar.gz
  • Upload date:
  • Size: 9.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.1.0.tar.gz
Algorithm Hash digest
SHA256 0f55efcca094b784397953ede9c8e3770f27f4df5b97dc4caa81f9140785cede
MD5 264296c47f34c2dc09a462ea2f7ce74f
BLAKE2b-256 fa4642beaae148ba27ebd9d1677c2afa9b8e748c3326d262282569dd4f601214

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ytdebunk-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.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.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b72fe29c05e2ae14704c560d8fc85df5a3e6a7a35d5920ff62cde0e50279f2aa
MD5 fba4e255d6c8b4a457d3b3f3e2c95a8e
BLAKE2b-256 1b143dbd7d90340e92afbf5bdab825084dd754f5b0b3e2ccaddbb065bc9746e2

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