YouSum on the command line - a CLI function for summarising long YouTube videos to get right to the point!

YouSum on the command line - a CLI function for summarising long YouTube videos to get right to the point!

Table of Contents

But Wait - it’s on the command line

After the debacle of not being able to host my YouSum program, I’ve gotten back in the habit of just running it locally on the command line. I mentioned the llm utility in a prior post as well… and you should make sure to export your OpenAI API key before making this happen

but here you go!

yousum() {
  if [ -z "$1" ]; then
    echo "Usage: yousum <YouTube URL>"
    return 1
  fi

  # Extract the video ID using macOS-compatible regex in sed
  local video_id=$(echo "$1" | sed -E 's/.*v=([a-zA-Z0-9_-]+).*/\1/')

  if [ -z "$video_id" ]; then
    echo "Invalid YouTube URL. Please provide a valid one."
    return 1
  fi

  # Run the command
  youtube_transcript_api "$video_id" | llm -s "You are an information extraction service. Perform the following:\
                STEP 0: Provide a SUMMARY of the content in 100 words or less.\
                STEP 1: Extract the 5-10 most interesting FACTS"
}

usage example:

yousum https://www.youtube.com/watch?v=CO-6iqCum1w

Related Posts

LLMs for translating Silicon Valley to MBA speak

LLMs for translating Silicon Valley to MBA speak

Use AI to bridge communication gaps between neurodivergent directness and workplace diplomacy

Read More
Living is more like wrestling than dancing...

Living is more like wrestling than dancing...

How Brazilian Jiu-Jitsu teaches us that success comes from doing ordinary things extraordinarily long

Read More

Get new posts via email

Intuit Mailchimp

Copyright 2024-infinity, Paul Pereyda Karayan. Design by Zeon Studio