Skip to content

Instantly share code, notes, and snippets.

@justingarrick
Last active October 4, 2015 05:57
Show Gist options
  • Save justingarrick/2588975 to your computer and use it in GitHub Desktop.
Save justingarrick/2588975 to your computer and use it in GitHub Desktop.
Youtube Bookmarks -> MP3
# !/bin/bash
# Justin Garrick
# Put this script in a folder with get_flash_videos (http://code.google.com/p/get-flash-videos/)
# and your bookmarks.html file and run it
# This does no error checking/handling -- if a video cannot be found, it just won't be grabbed
# Grabs the urls from all bookmarks containing youtube in the url
for URL in `grep -i "<a href=.*youtube.*" bookmarks.html | cut -d '"' -f 2`; do
echo "Downloading ${URL}..."
# Download video as high quality mp4 if possible
`./get_flash_videos -r high ${URL}`
done
for MP4 in `find . -iname "*.mp4"`; do
# Get the filename
PREFIX=`echo ${MP4} | cut -d '/' -f 2 | cut -d '.' -f 1`
# Try to encode with 2 audio channels (stereo) at 192kb/s -
# ffmpeg is finicky and youtube audio often sucks, so YMMV
`ffmpeg -i ${MP4} -vn -ac 2 -ab 192k ${PREFIX}.mp3`
# Delete the mp4, comment this if you want to keep it
rm -rf ${MP4}
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment