Embedding youtube video in experiment

I want to create an experiment which plays a video stimulus and is actually an online link that has been embedded in the pschopy experiment . Also, I want to chose the videos randomly from a set of 30 links .

This is, as far as I know, not possible. PsychoPy isn’t set up to display content pulled from other websites, and you can’t insert blocks of arbitrary HTML code into the experiment (which is what it would take).

Also, you shouldn’t need to do this at all. You should be able to just put the video files into the experiment directly without going through YouTube, and then randomize them like any other stimulus.