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

Slaying Software Zombies with LLMs (and lesser incantations)

Slaying Software Zombies with LLMs (and lesser incantations)

Please enjoy my PyOhio talk on slaying software zombies! I’m talking about a very real problem of dealing with metacode (tests, docs, bugs, requirements etc…) that are no longer completely accurate (thus, zombies) due to not being in sync with the product & its code updating.

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
Cute Accordion tricks - transposition and translation

Cute Accordion tricks - transposition and translation

I am a classical oboist by training and a software engineer by trade - which means I’ve got some aptitude for making tools to help learn Cajun Accordion.

Read More

Get new posts via email

Intuit Mailchimp

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