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_KEY
Alternatively, using an environment variable:
export GEMINI_API_KEY="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:
- Install Streamlit:
pip install streamlit
- Run the application:
streamlit run app.py
Screenshots of the Streamlit App
Environment Variables
Set the Gemini API token as an environment variable:
export GEMINI_API_KEY="your_api_key"
Detailed Process
-
Download Audio
- Uses
ytdebunk.downloader.download_audioto download audio from the given YouTube URL.
- Uses
-
Transcribe Audio
- Uses
ytdebunk.transcriber.transcribe_audioto generate a text transcription.
- Uses
-
Enhance Transcription (Optional)
- If
--enhanceis enabled,ytdebunk.refiner.enhance_transcriptionrefines the transcription using the Gemini API. - The API token must be provided via
--tokenor as an environment variable.
- If
-
Detect Logical Faults (Optional)
- If
--detectis enabled,ytdebunk.philosopher.detect_logical_faultsidentifies logical faults, fallacies, biases, irony, etc., using the Gemini API. - The API token must be provided via
--tokenor as an environment variable.
- If
-
Save Transcription
- The final audio, transcription, and detected logical faults (raw or enhanced) are saved to the
./outputfolder.
- The final audio, transcription, and detected logical faults (raw or enhanced) are saved to the
Error Handling
- If
--enhanceor--detectare 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.
Metadata
Release files for ytdebunk 1.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| ytdebunk-1.1.3.tar.gz | 11.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ytdebunk-1.1.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 23.8 kB
Release files / ytdebunk-1.1.3.tar.gz
| Download URL | ytdebunk-1.1.3.tar.gz |
|---|---|
| Size | 11.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
42a3c0ebc7e5065ff978ec136e7bb9b4a101a0f080413f02ff6f1a1fe3597e7a
|
|
BLAKE2b-256 checksum How to use checksums |
06918f32b9b146c9ee0317804bf3d5726b4e0e3a3254ba742b0d0fc3440b4e00
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.0
|
Release files / ytdebunk-1.1.3-py3-none-any.whl
| Download URL | ytdebunk-1.1.3-py3-none-any.whl |
|---|---|
| Size | 12.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
829c912d19183c30c323887a3cfcd6126c875094ae20dbf9b4db914812ca10f7
|
|
BLAKE2b-256 checksum How to use checksums |
2e28db9beda6e5c2fa50249bec880ff7a6dc7daea8cb3250278beb223a20950c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.0
|