Saturday, June 25, 2011

YouTube audio retrieval for Python

I am currently working on a project that requires audio retrieval from YouTube videos. So I wanted a batch processing program, that given a string query "Artist name - song title", it would retrieve the audio from the first N matches.
    The following figure shows the GUI for the code I wrote. You can just define the query string and the number of the retrieved videos (their audio actually).


Regarding the dependencies:
The whole code is based on youtube_dl, which I modified so as to act a callable function, rather as a command prompt program. The script requires the ffprobe and ffmpeg executables.


The files needed are :
YouTubeGUI.py
youtube_dl_mod.py
MIRyoutube.py (this contains modified functions from the YouTube API)

This may not be the best code ever but it does the trick. Really helped me and saved me a lots of time.

0 comments: