The Bash script youtube-bookmarks-mp3.sh is using Python youtube-dl script along with ffmpeg in order to download videos from YouTube service. It also enables youtube-dl to convert videos to mp3 audio format. The script exports YouTube links from Bookmarks and copy them into the file bookmarks.txt. Multiple videos are downloaded and converted simultaneously in the background by the script.


#!/bin/bash
# Script exports bookmarks from Google Chrome, donwload liks with youtube-dl and convert them to mp3 

 for binary in google-chrome youtube-dl ffmpeg; do
    type -P "$binary" &>/dev/null
    [ "$?" != 0 ] && echo -e "\n'$binary' required but not found, exiting!\n" && exit 1
 done

 cat ~/.config/google-chrome/Default/Bookmarks | grep youtube | cut -d ":" -f2-3 | cut -d '"' -f2 > bookmarks.txt

 if  [ ! -s bookmarks.txt ]; then
    echo -e "\nFile bookmarks.txt not found or is empty, exiting!\n" && exit 1
 fi

 for line in $(cat bookmarks.txt); do 
    youtube-dl --extract-audio --audio-format mp3 --audio-quality 0 --output "%(title)s.%(ext)s" "$line" &
    sleep 2 
 done

 
 exit 0

Note: According to YouTube Terms of Service, you shall not copy, reproduce, distribute, transmit, broadcast, display, sell, license, or otherwise exploit any Content for any other purposes without the prior written consent of YouTube or the respective licensors of the Content.