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) |
-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
-
Download Audio
- Uses the
download_audiofunction fromytdebunk.downloaderto download audio from the given YouTube URL.
- Uses the
-
Transcribe Audio
- Uses the
transcribe_audiofunction fromytdebunk.transcriberto generate a text transcription.
- Uses the
-
Enhance Transcription (Optional)
- If
--enhanceis enabled, the script usesenhance_transcriptionfromytdebunk.refinerto refine the transcription using the Gemini API. - The API token must be provided via
--tokenor as an environment variable.
- If
-
Save Transcription
- The final transcription (raw or enhanced) is saved to the specified output file.
Error Handling
- If
--enhanceis 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ytdebunk-1.0.1.tar.gz.
File metadata
- Download URL: ytdebunk-1.0.1.tar.gz
- Upload date:
- Size: 6.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
679ae5d4f4a9c3a08791f7d79150fc1a961546374585303cb348e830dc7443a6
|
|
| MD5 |
ba2c56e9222fec9a6fae2ec0285a86ea
|
|
| BLAKE2b-256 |
db18847b6eca0eb198b48b0109909a10e9e346e0724fc65348d8d05754b58c1d
|
File details
Details for the file ytdebunk-1.0.1-py3-none-any.whl.
File metadata
- Download URL: ytdebunk-1.0.1-py3-none-any.whl
- Upload date:
- Size: 7.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bbd6573f3d3ce6779d317c481c298b825860016392cc9df7421e72ec7b098676
|
|
| MD5 |
fbb0e0031f67d4c2b4888ed428223a5e
|
|
| BLAKE2b-256 |
ef10f2dba1f6dc24639bef1e0209c83cf50ce06e27a74efd27d2675e9d6141ee
|