Reformat a YouTube URL using jQuery
- by jamEs
I am using the YouTube Channel jQuery script to pull in data from a YouTube channel. Then I'm using an iFrame on the page to display the videos without leaving the site. The only problem is that the URLs the Channel plugin is pulling in don't quite work with my iFrame concept. They load the whole YouTube page instead of just the video. I figured out a workaround that basically I reformat the URL and tell it to display fullscreen and to autoplay will do what I would like it to do.
The URLs are currently formatted like
http://www.youtube.com/watch?v=xxxxxxxxx&feature=youtube_gdata
and I need them to be rewritten as
http://www.youtube.com/v/xxxxxxxxx?fs=1&autoplay=1
I've seen a couple of similar topics here on SO, but given my limited jQuery and regex talents I wasn't able to get anything to work for my purposes.