YouTube thumbnail help!
YouTube thumbnail help!
Hi, I'm entirely new to scripting... and I've finally given up searching the internet and trying to come up with my own plugin.
What I'm trying to do is obtain the ID of the YouTube video and inputting it into the css of a div tag as a background. Here's what I've come up with to do this:
-
vid = split('src="http://www.youtube.com/v/')[1].split('&rel=0&egm=0&showinfo=0&fs=1" type="application/x-shockwave-flash" width="248" height="222" allowFullScreen="true" wmode="transparent"')[0];
(There are two splits because the needed 11-character ID is burried within the embed code.)
The above grab the 11-character ID, and input it accordingly (I assume):
-
<div id="test" style="background: url(http://img.youtube.com/vi/"11-character ID ends up here"/0.jpg) no-repeat middle;">Content</div>
So, I hope no one minds helping me. Thanks, in advance.