An easy way to get music from YouTube and download it to the iTunes library along with information about its artist, title, album and album art.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

YouTunes - Multithreaded Music Download

An easy way to get music from YouTube and download it to the iTunes library along with information about its artist, title, album and album art.

@author Andrew Chang,

What It Does

YouTunes is a command line application that streamlines the annoying process of downloading music from YouTube. This program prompts the user for a search query for a certain song and uses the entered keywords to search YouTube for potential urls to download. These urls are displayed for the user, with information about the title of the song, the name of the channel / user, the length of the video, and the number of views to help the user select the correct video without having to listen to it.

The program simultaneously uses the keywords to look through Genius, gathering information about the artist, title, album and album art of the search results. This requires opening of several urls, resulting in a potentially long wait due to networking stall times. To combat this, I utilized multithreading to parallelize the stall times and reduce the overall wait time for the user. Similar to the first step, these results are displayed and the user selects the one that appears correct. The user can also enter manual information if no entries have the correct metadata for the given song.

This script utilizes some webscraping libraries (BeautifulSoup, requests) and a whole lot of regex to look through the HTML code of websites. To download the song, the script uses the youtube-dl library which conveniently downloads YouTube urls as mp3 files. The selected video should be downloaded successfully into the iTunes library, with all of the metadata beautifully edited to allow for successful sorting in iTunes. Hope this proves useful for you all!


Download Python 2.7 if needed. (This script is tailored for this version. Other versions may display unexpected bugs.)

Make sure /Library/Frameworks/Python.framework/Versions/2.7/bin (The path to execute Python 2.7 files) is in your Shell Path.


Pip3 (recommended)

Install or upgrade Pip3 if necessary. (Follow the above instructions, but type python3 instead of python for pip3)

Install the script and all requirements:

pip3 install youtunes OR


  1. Download the tarball here.

  2. Download all required libraries: urllib2, urllib, sys, re, youtube_dl, HTMLParser, bs4, os, eyed3, threading, requests, errno, avprobe, ffprobe


Self-explanatory (:


I do a hacky thing in the set_defaults function, which sets the terminal's default encoding to utf-8. In practice, this is frowned upon; I was just too lazy to find exactly where I had to use the encode function to properly deal with some decode / encode bugs that were popping up.


Create a front-end for this script.