Do you love learning through YouTube videos but struggle to keep organized notes for each one? Manually taking notes can be time-consuming, and existing services are often too costly for what they offer. Plus, wouldn’t it be great to customize your notes exactly the way you like?

With just a few lines of Python code, you can easily summarize YouTube videos into concise, readable study notes—all for free! Here’s how to do it.

Step 1: Install the Required Libraries

pip install youtube-transcript-api
pip install langchain
pip install langchain-openai
export OPENAI_API_KEY={YOUR_OWN_API_KEY}

Step 2: Import the Necessary Libraries

from youtube_transcript_api import YouTubeTranscriptApi
from langchain_core.output_parsers import StrOutputParser
from langchain_core.prompts import PromptTemplate
from langchain_openai import ChatOpenAI

Step 3: Set Up the ChatGPT Prompt (customize it for your need)

prompt = PromptTemplate.from_template("""
Act as an expert copywriter specializing in creating study notes. 

Your task is to take a given YouTube transcript and transform it into a
well-structured, succinct and useful note, that is easy to read. 

Your objectives are as follows:

Content Transformation: Begin by thoroughly reading the provided YouTube 
transcript. Understand the main ideas, key points, and the overall message
conveyed.

Original Quotes: For really great original sentences or conversations, please
include them as highlighted quotes.

Proofreading: Proofread the article for grammar, spelling, and punctuation errors. Ensure it is free of any mistakes that could detract from its quality.

By following these guidelines, create a well-optimized, unique, short and helpful
note for review in markdown format. Try to keep it less than 200 words.

Transcript:{transcript}
""")

Step 4: Generate the Notes

Take the video ID from any YouTube link (e.g., from https://www.youtube.com/watch?v=shVqZQvjDcY, use shVqZQvjDcY as the ID), and run the following code:

vid = 'shVqZQvjDcY'
transcript = YouTubeTranscriptApi.get_transcript(vid, languages=["en"])
full_text = " ".join(part["text"] for part in transcript)
summarizer = prompt | ChatOpenAI(model="gpt-4o-mini") | StrOutputParser()
final_notes = summarizer.invoke({"transcript": full_text})

Now, you turn any Youtube Video into a beautiful Markdown notes, that you can save.

Result

Now you can easily transform any YouTube video into beautifully formatted Markdown notes that you can save and refer back to anytime.

If you’re preparing for an interview, simply paste the generated notes into Synco, and get real-time reminders during the meeting. Try it out and streamline your study process!


Need more hands-on tips for study? Follow @congxing on X or LinkedIn: Congxing Cai.