Converting youtube and google video embed HTML into a SWFObj

Hi there,

Is there a small ruby / rails library that formats youtube or google
video
HTML embed code into SWFObject (SWFObject: Javascript Flash Player detection and embed script | deconcept)
HTML?
The code youtube and google video provide doesn’t always play nice in IE
apparently (that’s what one of our CSS gurus at work told me).

So I’m looking to turn this (which doesn’t play nice in all browsers):

<object width="425" height="350">
    <param name="movie" value="http://www.youtube.com/v/qqsyXdj_p_I

">



into this:

The project I’m working on is a social community and we’re trying to
keep
the comments people post on profile pages as valid as possible.

Thanks,
Dave

I forgot to mention, the whole site is in Rails… so that’s why I’m
asking
here :slight_smile:

Here’s a little more info on the issue:

Let’s say I have this string that contains 2 links for
embedding
youtube videos amongst some other random text.

string = “We’ve got some junk text here” +
“<object width="425" height="350"><param name="movie"
value="- YouTube +
“<param name="wmode" value="transparent"><embed
src="
- YouTube
type="application/x-shockwave-flash"” +
“wmode="transparent" width="425"
height="350">” +
“And we’ve got some more junk text right here” +
“<object width="425" height="350"><param name="movie"
value="- YouTube +
“<param name="wmode" value="transparent"><embed
src="
- YouTube
type="application/x-shockwave-flash"” +
“wmode="transparent" width="425"
height="350">” +
“more garbage text here”

I’d like to get the value of the ‘value’ attributes ("
- YouTube" and "
- YouTube" respectively) and convert the
string
into the following:

We’ve got some junk text here

And we've got some more junk text right here
more garbage text here

What would be the best library to use for parsing and replacing certain
values in a string? I’ve done simple .gsub’ing before, but this seems to
be
a little more complicated :wink:

Thanks,
Dave H.