The following code makes a couple of assumptions about the URL / id which are 
probably safe, but not guaranteed (that the ID will always be before an 
ampersand, and never contain any slashes).



<cfsavecontent variable="Code"><object width="550" height="331"><param 
name="movie" 
value="http://www.youtube.com/v/iNCsMTYkw1M&hl=en&fs=1&";></param><param
name="allowFullScreen" value="true"></param><param
name="allowscriptaccess" value="always"></param><embed 
src="http://www.youtube.com/v/iNCsMTYkw1M&hl=en&fs=1&";
type="application/x-shockwave-flash" allowscriptaccess="always"
allowfullscreen="true" width="550" 
height="331"></embed></object></cfsavecontent>

<!---
        INFO:
        Since CF doesn't have a HtmlParse we need to escape ampersands for XML:
--->
<cfset Code = replace(Code,'&','&amp;','all')/>

<!---
        INFO:
        Convert Code to XML nodeset and locate src of embed tag.
--->
<cfset XmlData = XmlParse(Code) />
<cfset EmbedSrc = XmlSearch(XmlData,'//embed/@src') />
<cfset VideoUrl = EmbedSrc[1].XmlValue />

<!---
        INFO:
        Locate Id by stripping away everything after the first & and everything 
before the last /
--->
<cfset VideoId = ListLast(ListFirst(VideoUrl,'&'),'/')/>



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:324761
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to