Open lexilexikon opened 1 month ago
Hey @lexilexikon! I was able to to get the following script to work in Raycast:
⚠️ To use this implementation you will need to download yt-dlp. On macOS you can run
brew install yt-dlp
#!/bin/zsh
# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title Fabric YouTube Summary Generation
# @raycast.mode compact
# Optional parameters:
# @raycast.icon 🤖
# @raycast.argument1 { "type": "text", "placeholder": "YouTube URL" }
# @raycast.packageName fabric-aliased-commands
# Documentation:
# @raycast.description Using fabric to generate YouTube Video summary
# @raycast.author dom_hallan
# @raycast.authorURL https://raycast.com/dom_hallan
# Source zsh configuration to get access to your PATH and aliases
source ~/.zshrc
# Validate input
if [ -z "$1" ]; then
echo "Error: Please provide a YouTube URL"
exit 1
fi
# Set Obsidian vault path
obsidian_base="/Users/domhallan/domhallan-obsidian-notes/notes/"
# Generate timestamp
date_stamp=$(date +'%Y-%m-%d')
# Get video title using yt-dlp
video_title=$(yt-dlp --get-title "$1" | tr -d '\n' | sed 's/:/-/g' | sed 's/[^a-zA-Z0-9-]/-/g' | tr -s '-')
output_file="${obsidian_base}${date_stamp}-${video_title}.md"
# Execute the command and save output
echo "# YouTube Summary: $1" > "$output_file"
echo "Date: $date_stamp" >> "$output_file"
echo "URL: $1" >> "$output_file"
echo "\n---\n" >> "$output_file"
# Debug: First get the transcript and save it
echo "Fetching transcript..."
transcript=$(fabric -y "$1" --transcript)
echo "Transcript length: ${#transcript}"
if [ -n "$transcript" ]; then
echo "Processing transcript with fabric..."
echo "$transcript" | fabric -sp extract_wisdom | tee -a "$output_file"
else
echo "Error: No transcript was fetched" | tee -a "$output_file"
fi
echo "\nSummary saved to: $output_file"
Make sure that when you select a YouTube video that you right click on the video itself and choose copy video URL
because the share sheet link does not work
Here is the recording of things working:
https://github.com/user-attachments/assets/5358c6e3-4280-4a95-a6de-7f4a1d165aea
I hope this is helpful!
@lexilexikon did this answer your question?
Hi @polyglotdev Thank you for your help! Unfortunately I'm still not able to get it running. Im using the script which is in the github repository. But I'm always getting the error message 'invalid YouTube URL, can't get video ID'. When I'm working with the terminal on my mac it works like a charm.
#!/bin/bash`
# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title Get YouTube Transcript
# @raycast.mode fullOutput
# Optional parameters:
# @raycast.icon 🧠
# @raycast.argument1 { "type": "text", "placeholder": "Input text", "optional": false, "percentEncoded": true}
# Documentation:
# @raycast.description Run fabric -y on the input text of a YouTube video to get the transcript from.
# @raycast.author Daniel Miessler
# @raycast.authorURL https://github.com/danielmiessler
# Set PATH to include common locations and $HOME/go/bin
PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:$HOME/go/bin:$PATH"
# Use the PATH to find and execute fabric
if command -v fabric >/dev/null 2>&1; then
fabric -y "${1}"
else
echo "Error: fabric command not found in PATH"
echo "Current PATH: $PATH"
exit 1
`fi
I'm new to coding, so I hardly understand what the bash script is doing.
@lexilexikon Where are you getting the URL for the YouTube video from?
I tried different ways. Right-click on the youtube video and clicking on the "copy video-url". I also tried to fetch it from the browser window (search bar). I know that the "www.yout.be..." URL seams to be problematic.
Discussed in https://github.com/danielmiessler/fabric/discussions/1032