<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Ebriz</title>
    <description>The latest articles on DEV Community by Ebriz (@ebriz).</description>
    <link>https://dev.to/ebriz</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2864541%2Fb60c769b-d8c7-4758-8ba5-a8ca90a7ec74.png</url>
      <title>DEV Community: Ebriz</title>
      <link>https://dev.to/ebriz</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ebriz"/>
    <language>en</language>
    <item>
      <title>Turn Entire YouTube Playlists to Markdown Formatted and Refined Text Books (in any language)</title>
      <dc:creator>Ebriz</dc:creator>
      <pubDate>Fri, 14 Feb 2025 20:27:16 +0000</pubDate>
      <link>https://dev.to/ebriz/turn-entire-youtube-playlists-to-markdown-formatted-and-refined-text-books-in-any-language-3m86</link>
      <guid>https://dev.to/ebriz/turn-entire-youtube-playlists-to-markdown-formatted-and-refined-text-books-in-any-language-3m86</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fetdd0vi0qs1jitq8wgti.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fetdd0vi0qs1jitq8wgti.jpg" alt="Image description" width="800" height="450"&gt;&lt;/a&gt;Give it any YouTube playlist(entire courses for instance) and receive a clean, formatted and structured file with all the details of that playlist.&lt;/p&gt;

&lt;p&gt;It's a simple yet effective script using the free Google Gemini API.&lt;/p&gt;

&lt;p&gt;I haven't found any free tool available with this scale, so I made one.&lt;/p&gt;

&lt;p&gt;Check it out : &lt;a href="https://github.com/Ebrizzzz/Youtube-playlist-to-formatted-text" rel="noopener noreferrer"&gt;https://github.com/Ebrizzzz/Youtube-playlist-to-formatted-text&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The project is divided into two main processing stages:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Transcript Extraction:&lt;/strong&gt;&lt;br&gt;
Using the pytube library and youtube_transcript_api, the application fetches the transcript for each video. It handles both full playlists and single video URLs. The extracted text is then consolidated into a single text file.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;AI-Powered Refinement:&lt;/strong&gt;&lt;br&gt;
The extracted transcript is then processed by Google’s Gemini API. Each chunk of a video is sent along with a context prompt that instructs Gemini to reorganize the content — adding headings, bullet points, and other formatting elements — without omitting any details. The final output is a neatly formatted markdown file.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Chunking and Context Strategy for Consistent Refinement&lt;/strong&gt;&lt;br&gt;
One of the key challenges of processing long-form transcripts is maintaining a consistent flow and structure across multiple chunks. Here’s how the process works:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Segmentation by Video:&lt;/strong&gt;&lt;br&gt;
The entire transcript is first divided into separate sections for each video. This ensures that every video’s content is processed individually and retains its unique context.&lt;br&gt;
&lt;strong&gt;Dividing Each Video into Chunks:&lt;/strong&gt;&lt;br&gt;
For each video, the transcript is further split into chunks based on the number of words. This step is critical because the Gemini API has a limited context window. We empirically set a chunk size (e.g., 3000 words) to strike a balance between detail and manageability.&lt;br&gt;
&lt;strong&gt;Refinement with Contextual Prompts:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;First Chunk:&lt;/strong&gt; The initial chunk of a video is sent directly to Gemini(with the fixed prompt) for refinement. This establishes the baseline structure and style.&lt;br&gt;
&lt;strong&gt;Subsequent Chunks:&lt;/strong&gt; For every following chunk, the prompt is prefixed with a context reminder that includes the previously refined text. Essentially, it tells Gemini, “This is what you already processed; now, refine what comes next.” This method ensures that the AI doesn’t treat each chunk in isolation but instead builds upon previous content, maintaining a consistent narrative flow.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Choosing the Right Context Size:&lt;/strong&gt;&lt;br&gt;
Selecting the appropriate context size is tricky. It needs to be small enough to fit within the Gemini API’s input and output limits — ensuring no detail is lost or overly summarized — yet large enough to provide sufficient context to avoid hallucinations or inconsistencies. This balance is crucial for generating coherent and accurate refinements across the entire video transcript.&lt;br&gt;
Key Features&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Automatic Transcript Extraction:&lt;/li&gt;
&lt;li&gt;Seamlessly pulls transcripts from YouTube playlists or individual video URLs.&lt;/li&gt;
&lt;li&gt;Language Support: Users can specify the output language. Although English is the default, the application supports other languages — give it a try!&lt;/li&gt;
&lt;li&gt;PyQt5 Graphical Interface:&lt;/li&gt;
&lt;li&gt;A simple yet effective GUI built with PyQt5.&lt;/li&gt;
&lt;li&gt;Batch Processing &amp;amp; Gemini Refinement:&lt;/li&gt;
&lt;li&gt;The application handles large playlists by processing each video sequentially and using a robust prompt for the Gemini API to ensure coherent, refined output.&lt;/li&gt;
&lt;li&gt;Customizable Gemini Model: Choose from different Gemini models (e.g., gemini-1.5-flash, gemini-2.0-flash) depending on your needs.&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
  </channel>
</rss>
