Skip to main content

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

Project description

ytdebunk

Overview

ytdebunk is a command-line tool that can be installed via pip. It takes a youtube video link as an argument and does a lots of works for you automatically. This repository contains the source code and a demonstration of its features.

Current Features:

  • Download audio from YouTube videos.
  • Transcribe the audio content.
  • Optionally enhance the transcription using the Gemini API.
  • Optionally detect logical faults in the transcription using the Gemini API.
  • Store the audio, transcription and logical errors in local folder

There is also a Streamlit-based demo application.

Upcoming Features:

  • Classifying assertive claims within the transcription.
  • Fact-checking and validating claims using online searches and agentic AI.
  • Categorizing factual and logical faults.
  • Generating a script for a hypothetical debunker character using generative AI (or AI Agents).
  • Synthesizing the script into audio and 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, helping to prepare debunk videos.

Installation

To avoid conflicts, it is recommended to create a virtual environment:

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

Now, install ytdebunk from PyPI:

pip install ytdebunk

Alternatively, install the latest version directly from GitHub:

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

Usage (CLI Tool)

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

Arguments

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

Options

Option Description
-l, --language (str) Language code for transcription. Supported: [bn, en] (default: en)
-e, --enhance (bool) Enhance the transcription using the Gemini API (default: False)
-d, --detect (bool) Detect logical faults using the Gemini API (default: False)
-v, --verbose (bool) Enable verbose logging.
-t, --token (str) API token for Gemini API (Required if --enhance or --detect is enabled)
-st, --start_time (float) Start time of the audio clip (seconds)
-et, --end_time (float) End time of the audio clip (seconds)
-m, --model (str) Transcription model from Hugging Face (WhisperFeatureExtractor)

Example Usage

ytdebunk "https://www.youtube.com/watch?v=example" -e -d -v -t YOUR_GEMINI_API_TOKEN

Alternatively, using an environment variable:

export GEMINI_API_TOKEN="your_api_key"
ytdebunk "https://www.youtube.com/watch?v=example" -e -d -v

For more examples, check the Example Notebook.

Usage (Streamlit App)

To run the demo using Streamlit:

  1. Install Streamlit:
pip install streamlit
  1. Run the application:
streamlit run app.py

Screenshots of the Streamlit App

Query Fields English Transcription Result English Query Fields Bangla Transcription Result Bangla Logical Faults Detected Bangla

Environment Variables

Set the Gemini API token as an environment variable:

export GEMINI_API_TOKEN="your_api_key"

Detailed Process

  1. Download Audio

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

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

    • If --enhance is enabled, ytdebunk.refiner.enhance_transcription refines 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, ytdebunk.philosopher.detect_logical_faults identifies logical faults, fallacies, biases, irony, etc., using the Gemini API.
    • The API token must be provided via --token or as an environment variable.
  5. Save Transcription

    • The final audio, transcription, and detected logical faults (raw or enhanced) are saved to the ./output folder.

Error Handling

  • If --enhance or --detect are enabled but no Gemini API token is provided, the script exits with an error message.

License

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

Contribution & Contact

Contributions are welcome! Fork the project and submit a pull request to add new features or improve existing ones.

For inquiries, contact the project 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.2.tar.gz (11.3 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.2-py3-none-any.whl (11.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ytdebunk-1.1.2.tar.gz
  • Upload date:
  • Size: 11.3 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.2.tar.gz
Algorithm Hash digest
SHA256 e2d557d7df13a491b9c5761cae39f093561fc5e8a995d44cf6528b1c70e3842d
MD5 e349b73989f1745d3f5490f006f15d22
BLAKE2b-256 72fc6bae49f96a9e4ad66350773d9382ec3f9bf11705b25076aa4f338c95dbaa

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ytdebunk-1.1.2-py3-none-any.whl
  • Upload date:
  • Size: 11.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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 31cebe9017c585c63f884ae2c70e81ecd92a9e796685e0b14847cf138a27f210
MD5 90fb79af3bce73427eed511f9616be5e
BLAKE2b-256 1d5f8033a56a8ef441a9b15e686bde4aa06befbc937dd9af53c77f6c02f35cc8

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