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

llm - for command line LLM Prototyping

llm - for command line LLM Prototyping

I have been doing a lot of exploration and prototyping for “The Intelligent Enterprise” (tm mine obvi) using LLMs.

Read More
2024 - book recommendations / a look back

2024 - book recommendations / a look back

I went back through the books I read in 2024 and they’re somewhat disappointing.

Read More
Thoughts on Return-To-Office and Agile Manifesto

Thoughts on Return-To-Office and Agile Manifesto

As I think about our San Francisco office and realise that the pain of commuting is well outweighed by the chance to move faster, have fun in a “clubhouse” with interesting people, and to mentor some really talented young people… the Agile Manifesto came back to me.

Read More

Get new posts via email

Intuit Mailchimp

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