YouTube Video Processing Enhancements

Enhanced YouTube Video Processing System

Major Changes

1. Video Page Generation

  • Added automatic markdown page generation for each YouTube video in src/content/videos
  • Implemented smart filename generation using video metadata:
    text
    YouTube-Video_${year}-${month}-${day}_${channelTitle}--${videoTitle}.md
  • Added character sanitization for filenames to ensure compatibility

2. Content Management

  • Added videoPage settings to USER_OPTIONS for centralized configuration
  • Implemented content consistency checking to avoid duplicate entries
  • Added automatic YAML frontmatter generation for video pages
  • Integrated video descriptions into markdown pages

3. File Handling System

  • Added handleYouTubeVideoMarkdown function for managing video markdown files
  • Implemented file existence checks and update logic
  • Added statistics tracking for:
    • Created files
    • Modified files
    • Skipped files (no changes needed)

4. Content Structure

  • Enhanced markdown page structure with:
    • YAML frontmatter containing metadata
    • Video title and iframe embed
    • Video description section
    • Original content preservation
    • Cross-reference tracking

Technical Details

New Functions

  1. getFullMarkdownPageForOneYoutubeVideo:
    • Assembles complete markdown page content
    • Handles YAML frontmatter generation
    • Manages iframe code insertion
    • Preserves existing content
  2. handleYouTubeVideoMarkdown:
    • Manages file operations
    • Implements update logic
    • Tracks operation statistics
    • Ensures directory structure

Configuration Options

Added new USER_OPTIONS.videoPage settings:
typescript
videoPage: {
  directory: 'src/content/videos',
  stripTitleOfUnsafeCharacters: (title: string) => string,
  getFileName: (publishedDate, channelTitle, videoTitle) => string,
  getAnyContentForOneVideoMarkdownPage: (youtubeData) => Promise<string>
}

Impact

  • Improved organization of video content
  • Enhanced metadata tracking
  • Better content consistency
  • Automated file management
  • Reduced manual intervention needed

Usage

The system now automatically:
  1. Creates individual pages for each YouTube video
  2. Maintains consistent formatting
  3. Preserves video metadata
  4. Tracks video usage across the site
  5. Updates content when needed
No manual intervention required - the system handles all file operations automatically while processing YouTube links in markdown files.