Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

YouTubeCC-AI-Summarizer

Java License: MIT Build Status AI Powered


Overview

YouTubeCC-AI-Summarizer is a Java tool that automates extraction of YouTube Closed Captions (CC), structures the subtitle data with video metadata, and leverages AI (via Requesty API) to summarize, explain, and translate the content into English—or any language you choose. The final result is saved as a Markdown (.md) file, ready for sharing or publication.


Features

  • YouTube URL Input: Accepts any standard YouTube video link.
  • Automatic CC Extraction: Fetches and parses closed captions (subtitles) directly from the video.
  • Structured JSON Output: Extracts video metadata (title, channel, etc.) alongside the CC in a unified JSON format.
  • AI-Driven Processing: Sends the extracted data to an AI (via Requesty API) to generate:
    • Summaries
    • Explanations
    • Translations (default is English, but you can change the prompt for any language)
  • Markdown Export: Saves the AI-generated summary/explanation in a .md file (named after your input or channel).
  • First 100 Words Preview: Prints a preview of the AI's response in the terminal for quick review.

How It Works

  1. User Input: Enter a YouTube video URL when prompted.
  2. CC & Metadata Extraction: The program fetches the closed captions and relevant video info.
  3. AI Summarization/Translation: The extracted data is sent to an AI for summarization and translation via the Requesty API.
  4. Output: The first 100 words of the AI's response are printed to the console, and the full output is saved as a Markdown file.

API Setup

This project uses the Requesty AI API for AI-powered summarization and translation.
You receive $1 in free credits when you sign up for an account.

How to get your API Key

  1. Go to https://app.requesty.ai/ and register for a free account.
  2. After verifying your email, navigate to the API section or dashboard to find your API key.

How to add your API key

Open the AI_Work class in the org.company package:

public class AI_Work {
    public static String AIResponse(JsonObject userRequestJson){
        String apiKey = "YOUR_API_KEY_HERE"; // Replace with your actual API key
        String endpoint = "https://router.requesty.ai/v1/chat/completions";
        String model = "openai/gpt-4.1-nano";
        // ...
    }
}

Replace YOUR_API_KEY_HERE with your actual Requesty API key.

Note:
For demonstration and personal/small-scale use, this direct approach is sufficient.
If you intend to build and deploy an API or a public-facing application using this code:
do NOT hard-code your API key in the source code or expose it in client-side code.
Instead, keep your API key on your server and proxy requests through your backend for better security.


Usage

1. Clone the Repository

git clone https://github.com/NVSRahul/YouTubeCC-AI-Summarizer.git
cd YouTubeCC-AI-Summarizer

2. Install Dependencies

  • Java 11 or higher is required.
  • If using Maven, run:
    mvn clean install
  • If using Gradle, run:
    gradle build
  • Make sure to include any required libraries, such as:
    • com.google.code.gson:gson

3. Run the Program

The main entry point is the Final_Run class in the org.company package.

java -cp target/your-jar-with-dependencies.jar org.company.Final_Run

Note:
Replace your-jar-with-dependencies.jar with the actual jar file name generated by your build tool (e.g., YouTubeCC-AI-Summarizer-1.0-SNAPSHOT-jar-with-dependencies.jar).
Check the target/ (for Maven) or build/libs/ (for Gradle) directory for the correct file name.

4. Follow the Prompt

  • Enter the full YouTube video URL when prompted.
  • The program will display the first 100 words of the AI's Markdown summary in the terminal.
  • The full Markdown file will be saved in the project directory (named after the channel or context).

Example Output

Enter the YouTube video URL: 
https://www.youtube.com/watch?v=dQw4w9WgXcQ
AI Response (first 100 words):
Rick Astley's "Never Gonna Give You Up" is a classic pop song released in 1987...

A new file like RickAstley.md or [channelname].md is created with the full summary and translation.


Customization

  • Change Output Word Limit: Edit the wordLimit variable in the Final_Run class.
  • Change AI Model: Update the model parameter in your AI call in AI_Work.
  • Change AI Prompt / Language:
    You can change the AI prompt (for summary, translation, explanation, and target language) directly in the AI_Work class.
    For example, if you want the AI to summarize or translate into another language, simply modify the prompt string accordingly.
  • Format of Output File: The output is Markdown for easy publishing and sharing.

Security Notice for Developers

  • Do not commit your API key to public repositories or expose it in client-side code.
  • If you want to build a public API with this code, always handle the API key and all AI requests on your server side to keep your key secure.

License

MIT License. See LICENSE for details.


Contributing

Pull requests and issues are welcome! Please open a discussion or issue for major changes.


Acknowledgements


About

No description, website, or topics provided.

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages