I couldn't find anything online regarding this, so after scrounging the net a bit I worked up a solution. The problem was to automate playing the first video result on youtube of a keyword search.