Refactor of youtube function.